/*Filename: m_psid.do
*Last revised: 2021-08-25

Description: 
This file cleans and manipulates data created by extract.do

*************************************************
*/
 
*Preamble
clear all
program drop _all
cap log close
set maxvar 32000

set more off
*************************************************
* Directories
//gl rawdata   "/users/kvosters/PSID/data/"

* Log file
cd $rawdata
log using m_psid.log, replace

* Use data
use psidmain, clear

***********************************************************************************;
*----------------------------- Programs for later use  ----------------------------;

*Program to create new variables (empty), and gl for each set (var1, var2, ... , var$NW) 
program newstubs
 args glbname stublist 
 global `glbname' " `stublist' 	"
 foreach var in ${`glbname'} { 	
 forv i=1/$NW {					
   gen `var'`i'=.				
   gl `var' ${`var'} `var'`i'	
  }								
  di ${`var'}
  }								
 macro drop `glbname'  
end


*Program for replacing new (empty) variables with original (raw) values
program convertnames
  args orig new
  
  forv i=1/$NW {
   local a : word `i' of ${`orig'}
   local b : word `i' of ${`new'}
   replace `b'=`a'
   } 
 drop ${`orig'}
 cap gen dummiss=.
 cap gen check=.
end


***********************************************************************************;
*----------------------------- File structure information -------------------------;
** NOTE: setting number of waves;
gl NW=41

** NOTE: The waves/variables/years line up as follows												
/*	 
	1	1968		11	1978		21	1988		31	1999	41 2019
	2	1969		12	1979		22	1989		32	2001
	3	1970		13	1980		23	1990		33	2003
	4	1971		14	1981		24	1991		34	2005
	5	1972		15	1982		25	1992		35	2007
	6	1973		16	1983		26	1993		36	2009
	7	1974		17	1984		27	1994		37	2011
	8	1975		18	1985		28	1995		38  2013	
	9	1976		19	1986		29	1996		39  2015	
	10	1977		20	1987		30	1997		40	2017
*/

* Globals each wave, holding the associated survey year (i.e., $survyear1 = 1968)
forv i=1/29 {
gl survyear`i'=(1967+`i')
}
*
forv i=30/$NW {
gl survyear`i'=1967+`i'+(`i'-30)
}

** Place holder variables:
* DUMMISS is a permanent placeholder for waves in which variable is not available;
* CHECK is a temporary placeholder for variable/waves that still need to be investigated;
gen dummiss=.
gen check=.

/* NOTE: variables already done in extract.do :
	 sex			 --
	 id				1-40
	 seq			1-40
	 rel			1-40
	 age			1-40
	 birthyr		16-40
	 mar			1-40
	 empstat		12-40		// never used in this file
	 attlast		18-38		// never used in this file
	 attend			12-36		// never used in this file
	 sch			1, 3-40
	 iwgt			1-37 (individual longitudinal weights)
*/
*Create missing variables for those not available during certain waves (indiv file)
gen sch2=.

forv i=1/15 {
 gen birthyr`i'=.
 }

*Create unique individual ID
gen ID=(id1*1000)+seq1

***********************************************************************************;
*----------------------------- Sample Information ---------------------------------;
** NOTE: uses individual data and family data;
** NOTE: individual file has some insample variables we're not using at this point;

gen src=.
 replace src=1 if id1>=0 & id1<=3000 	 // SRC sample
 replace src=0 if id1>=3001 & id1<=4000  // Immigrant samples (1997, 1999)
 replace src=0 if id1>=4001 & id1<=5000  // Immigrant samples (2017, 2019)
 replace src=0 if id1>=5001 & id1<=7000  // SEO sample
 replace src=0 if id1>=7001 & id1<=9308 // Latino sample


*Longitudinal family weights. 
#delimit ;
newstubs weights "famwgtin" ;
gl famwgtin_orig 
	v439   	v1014  
	v1609  	v2321	v2968	v3301	v3721	v4224	v5099	v5665	 v6212  v6805	
	v7451  	v8103	v8727  	v9433  	v11079 	v12446	v13687	v14737 	 v16208 v17612 	
	v18943 	v20243 	v21547 	v23361	er4160	er7000	er9251	er12084	er16518	er20394
	er24179 er28078 er41069 er47012 er52436 er58257	er65492	er71570 er77631 ;
# delimit cr
convertnames famwgtin_orig famwgtin


forv i=1/$NW {
  *** Sample members;						
  gen sample`i'=.
  replace sample`i'=1 if `i'==1 & id`i'!=0 & seq`i'<170 		
  replace sample`i'=1 if `i'> 1 & id`i'!=0 & seq`i'!=0 
  
  *** Heads of household;
  gen head`i'=.
  replace head`i'=1 if `i'<=15 & sample`i'==1 & rel`i'==1  & (seq`i'>=1 & seq`i'<=20)
  replace head`i'=1 if `i'>15  & sample`i'==1 & rel`i'==10 & (seq`i'>=1 & seq`i'<=20)
  replace head`i'=0 if sample`i'==1 & head`i'==.

  *** Wives;
  gen wife`i'=.
  replace wife`i'=1 if `i'<=15 & mar`i'==1 & rel`i'==2  & (seq`i'>=1 & seq`i'<=20)
  replace wife`i'=1 if `i'>15  & mar`i'==1 & rel`i'==20 & (seq`i'>=1 & seq`i'<=20)			
  replace wife`i'=0 if sample`i'==1 & wife`i'==.

  *** Dead--individuals who were living in previous survey but died before current survey;
  gen died`i'=.
  replace died`i'=1 if `i'>1 & (seq`i'>=81 & seq`i'<=89)  

  *** Family Weights;
  gen famwgt`i'=famwgtin`i'
}

***********************************************************************************;
*----------------------------- Demographics ---------------------------------------;
** NOTE: uses individual file and family file; 
** NOTE: new individual file does not code missing values;
	
*Create new vars (to hold orig values) & global for each set of variables
#delimit ;
newstubs demographics
 "	racehdin
 	racewfin
 	ethnichdin
 	ethnicwfin
 	famsizein
 	numkidsin
	yngkidagein
 	fathereduhdin
 	mothereduhdin
 	fathereduwfin
 	mothereduwfin
	colattendhdin
	colattendwfin
	famsize			
	numkids
	yngkidage
	agecat 			
	calcage
	ethnicin
	racein
	raceai  
	racehdai  
	fathereduhd   
	mothereduhd   
	fathereduwf   
	mothereduwf   
	colattendhd    
	colattendwf   
	colattend        
	colattendsp 
	agehdin
	agewfin
	agehd
	agewf
 " ;

*Create globals for original variables names
set more off
#delimit ;
gl racehdin_orig  													
	v181   	v801   
	v1490	v2202	v2828	v3300	v3720	v4204	v5096	v5662	v6209	v6802  
	v7447  	v8099  	v8723  	v9408  	v11055 	v11938 	v13565	v14612	v16086 	v17483 
	v18814 	v20114 	v21420 	v23276	er3944	er6814	er9060	er11848	er15928	er19989
	er23426 er27393 er40565 er46543 er51904 er57659	er64810	er70882 er76897 ;  	
gl racewfin_orig																	
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	v12293	v13500	v14547	v16021	v17418
	v18749	v20049	v21355	v23212	er3883	er6753	er8999	er11760	er15836	er19897
	er23334 er27297 er40472 er46449 er51810 er57549	er64671	er70744 er76753 ;
gl ethnichdin_orig		
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	v11937	v13564	v14611	v16085	v17482	
	v18813	v20113	v21419	v23275	er3941	er6811	er9057	dummiss	er15932 er19993
	er23430 er27397 er40569 er46547 er51908 er57663	er64815	er70887 er76902 ;
gl ethnicwfin_orig	
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	v12292	v13499	v14546	v16020	v17417
	v17417	v20048	v21354	v23211	er3880	er6750	er8996	dummiss	er15840 er19901
	er23338 er27301 er40476 er46453 er51814 er57553	er64676	er70749 er76757 ;  
gl famsizein_orig
	v115   	v549   
	v1238	v1941	v2541	v3094	v3507	v3920	v4435	v5349	v5849	v6461  
	v7066  	v7657   v8351   v8960 	v10418 	v11605 	v13010 	v14113 	v15129 	v16630  
	v18048  v19348	v20650 	v22405 	er2006 	er5005 	er7005 	er10008 er13009 er17012
	er21016 er25016 er36016 er42016 er47316 er53016 er60016 er66016 er72016 ;
gl numkidsin_orig
	v398	v550
	v1242	v1945	v2545	v3098	v3511	v3924	v4439	v5353	v5853	v6465
	v7070	v7661	v8355	v8964	v10422	v11609	v13014	v14117	v15133	v16634
	v18052	v19352	v20654	v22409	er2010	er5009	er7009	er10012	er13013 er17016
	er21020 er25020 er36020 er42020 er47320 er53020	er60021	er66021 er72021 ;
gl yngkidagein_orig
	v120	v1013	
	v1243	v1946	v2546	v3099	v3512	v3925	v4440	v5354	v5854	v6466	
	v7071	v7662	v8356	v8965	v10423	v11610	v13015	v14118	v15134	v16635	
	v18053	v19353	v20655	v22410	er2011	er5010	er7010	er10013	er13014	er17017	
	er21021	er25021	er36021	er42021	er47321	er53021	er60022	er66022 er72022 ;
* 0. Illiterate (included in 1 for 1968)/NA, 1. 0-5 grades, 2. 6-8 grades, 3. 9-11 grades, 4. 12 grades (HS), 
* 5. HS plus non-academic training, 6. college but no degree, 7. college degree, 8. college, advanced, or prof. degree, 
* 9. NA/DK, 98. Wild, 99. DK/NA;
*Pulled forward from previous surveys except in 1994-1996, 1999, and 2001;	
gl fathereduhdin_orig
	v318	v793 
	v1484	v2196 	v2822 	v3240 	v3662	v4138 	v4681 	v5601 	v6150 	v6747
	v7380 	v8032 	v8656 	v9342 	v10989 	v11922 	v13549 	v14596 	v16070 	v17467
	v18798 	v20098 	v21404 	v23260 	er3924 	er6794 	er9040 	er11816 er15894 er19955
	er23392 er27356 er40531 er46508 er51869 er57622	er64773	er70845 er76860;	
* 0. Illiterate/NA, 1. 0-5 grades, 2. 6-8 grades, 3. 9-11 grades, 4. 12 grades (HS), 5. HS plus non-academic training, 
* 6. college but no degree, 7. college degree, 8. college, advanced, or prof. degree, 9. NA/DK, 98. Wild, 99. DK/NA;
*Pulled forward from previous surveys except in 1994-1996, 1999, and 2001;	
gl mothereduhdin_orig
	dummiss	dummiss	
	dummiss dummiss dummiss dummiss v3634 	v4139 	v4682 	v5602 	v6151 	v6748
	v7381 	v8033 	v8657 	v9343 	v10990 	v11923 	v13550 	v14597 	v16071 	v17468
	v18799 	v20099 	v21405 	v23261 	er3926 	er6796 	er9042 	er11824 er15903 er19964
	er23401 er27366 er40541 er46518 er51879 er57632	er64783	er70855 er76870;
* 0. Illiterate/NA, 1. 0-5 grades, 2. 6-8 grades, 3. 9-11 grades, 4. 12 grades (HS), 5. HS plus non-academic training, 
* 6. college but no degree, 7. college degree, 8. college, advanced, or prof. degree, 9. NA/DK, 98. Wild, 99. DK/NA;
*Pulled forward from previous surveys except in 1994-1996, 1999, and 2001;	
gl fathereduwfin_orig
	dummiss	dummiss	
	dummiss dummiss dummiss dummiss v3608 	v4108 	v4753 	v5572 	v6121 	v6718 
	v7351 	v8003 	v8627 	v9313 	v10960 	v12277 	v13485 	v14532 	v16006 	v17403
	v18734 	v20034 	v21340 	v23197 	er3864 	er6734 	er8980 	er11735 er15809 er19870
	er23307 er27267 er40442 er46414 er51775 er57512	er64634	er70707 er76715 ;	
* 0. Illiterate/NA, 1. 0-5 grades, 2. 6-8 grades, 3. 9-11 grades, 4. 12 grades (HS), 5. HS plus non-academic training, 
* 6. college but no degree, 7. college degree, 8. college, advanced, or prof. degree, 9. NA/DK, 98. Wild, 99. DK/NA;
*Pulled forward from previous surveys except in 1994-1996, 1999, and 2001;	
gl mothereduwfin_orig
	dummiss	dummiss	
	dummiss dummiss dummiss dummiss v3609 	v4109 	v4754 	v5573 	v6122 	v6719
	v7352 	v8004 	v8628 	v9314 	v10961 	v12278 	v13486 	v14533 	v16007 	v17404
	v18735 	v20035 	v21341 	v23198 	er3866 	er6736 	er8982 	er11743 er15818 er19879
	er23316 er27277 er40452 er46424 er51785 er57522	er64644	er70717 er76725;
gl colattendhdin_orig																	
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	v11956	v13579	v14626	v16100	v17497
	v18828	v20128	v21434	v23290	er3959	er6829	er9075	er11865	er15948	er20009
	er23446 er27413 er40585 er46563 er51924 er57680	er64832	er70904 er76919;
gl colattendwfin_orig																	
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	v12311	v13510	v14557	v16031	v17428
	v18759	v20059	v21365	v23222	er3894	er6764	er9010	er11777	er15856	er19917
	er23354 er27317 er40492 er46469 er51830 er57570	er64693	er70766 er76774;	
gl agehdin_orig
	v117	v1008
	v1239	v1942	v2542	v3095	v3508	v3921	v4436	v5350	v5850	v6462
	v7067	v7658	v8352	v8961	v10419	v11606	v13011	v14114	v15130	v16631
	v18049	v19349	v20651	v22406	er2007	er5006	er7006	er10009	er13010	er17013
	er21017	er25017	er36017	er42017	er47317	er53017	er60017	er66017 er72017 ;
gl agewfin_orig
	v118	v1011	
	v1241	v1944	v2544	v3097	v3510	v3923	v4438	v5352	v5852	v6464
	v7069	v7660	v8354	v8963	v10421	v11608	v13013	v14116	v15132	v16633
	v18051	v19351	v20653	v22408	er2009	er5008	er7008	er10011	er13012	er17015
	er21019	er25019	er36019	er42019	er47319	er53019	er60019	er66019 er72019 ;

#delimit cr

* Match up original vars with new vars (so col3 vars hold raw values)
convertnames 	racehdin_orig 			racehdin						
convertnames 	racewfin_orig 			racewfin
convertnames 	ethnichdin_orig 		ethnichdin
convertnames 	ethnicwfin_orig 		ethnicwfin
convertnames 	famsizein_orig 			famsizein
convertnames 	numkidsin_orig 			numkidsin
convertnames 	yngkidagein_orig 		yngkidagein
convertnames 	fathereduhdin_orig 		fathereduhdin
convertnames 	mothereduhdin_orig 		mothereduhdin
convertnames 	fathereduwfin_orig 		fathereduwfin
convertnames 	mothereduwfin_orig 		mothereduwfin
convertnames	colattendhdin_orig		colattendhdin
convertnames	colattendwfin_orig		colattendwfin
convertnames	agehdin_orig			agehdin
convertnames	agewfin_orig			agewfin

* Recodes
forv i=1/26 {
  replace fathereduhd`i'=fathereduhdin`i'	
  replace mothereduhd`i'=mothereduhdin`i'   
  replace fathereduwf`i'=fathereduwfin`i'	
  replace mothereduwf`i'=mothereduwfin`i'
 }
forv i=27/29 {
  replace fathereduhd`i'=fathereduhd`=`i'-1' 		if sample`i'==1 & (fathereduhdin`i'==. | fathereduhdin`i'==0)
  replace mothereduhdin`i'= mothereduhdin`=`i'-1' 	if sample`i'==1 & (mothereduhdin`i'==. | mothereduhdin`i'==0)
  replace fathereduwf`i'=fathereduwf`=`i'-1' 		if sample`i'==1 & (fathereduwfin`i'==. | fathereduwfin`i'==0)
  replace mothereduwfin`i'= mothereduwfin`=`i'-1' 	if sample`i'==1 & (mothereduwfin`i'==. | mothereduwfin`i'==0)
}
forv i=30/30 {
  replace fathereduhd`i'=fathereduhdin`i'	
  replace mothereduhd`i'=mothereduhdin`i'   
  replace fathereduwf`i'=fathereduwfin`i'
  replace mothereduwf`i'=mothereduwfin`i'
 }
forv i=31/32 {
  replace fathereduhd`i'=fathereduhd`=`i'-1' 		if sample`i'==1 & (fathereduhdin`i'==. | fathereduhdin`i'==0)
  replace mothereduhdin`i'= mothereduhdin`=`i'-1' 	if sample`i'==1 & (mothereduhdin`i'==. | mothereduhdin`i'==0)
  replace fathereduwf`i'=fathereduwf`=`i'-1' 		if sample`i'==1 & (fathereduwfin`i'==. | fathereduwfin`i'==0)
  replace mothereduwfin`i'= mothereduwfin`=`i'-1' 	if sample`i'==1 & (mothereduwfin`i'==. | mothereduwfin`i'==0)
}	
forv i=33/$NW {
  replace fathereduhd`i'=fathereduhdin`i'	
  replace mothereduhd`i'=mothereduhdin`i'   
  replace fathereduwf`i'=fathereduwfin`i'
  replace mothereduwf`i'=mothereduwfin`i'
 }
 
forv i=1/$NW {
  ** Basic household characteristics; 
  replace famsize`i'=famsizein`i'
  replace numkids`i'=numkidsin`i'
  replace yngkidage`i'=yngkidagein`i'
  
  * NOTE:  new individual file does not code missing values for age or schooling;
  replace age`i'=. if age`i'==999 
  replace sch`i'=. if sch`i'==98 | sch`i'==99 | sch`i'==0 

  ** Age categories;
  replace agecat`i'=0  if age`i'>=0 & age`i'<18   		
  replace agecat`i'=1  if age`i'>=18 & age`i'<25		 
  replace agecat`i'=2  if age`i'>=25 & age`i'<35 	
  replace agecat`i'=3  if age`i'>=35 & age`i'<45 	
  replace agecat`i'=4  if age`i'>=45 & age`i'<55 	 
  replace agecat`i'=5  if age`i'>=55 & age`i'<65 	 
  replace agecat`i'=6  if age`i'>=65 & age`i'<75 	 
  replace agecat`i'=7  if age`i'>=75 
  
  ** Head and Wife age
  replace agehd`i'=agehdin`i'
  replace agewf`i'=agewfin`i'

  ** Race and ethnicity dummies; 
  * 1968 - 1984:   1. White, 2. Negro, 3. Puerto Rican, Mexican, 7. Other, 9.  N.A.;
  * 1985 - 1991: ethnicity then race
       *Ethnicity:  1. Mexican, 2. Mexican American, 3. Chicano, 4. Puerto Rican, 5. Cuban, 
       *            6. Combination more than 1 mention, 7. Other Spanish, 9. NA DK, 0.  Inap. is not Spanish/Hispanic
       *Race:       1. White, 2. Black, 3. American Indian, Aleut, Eskimo, 4. Asian, Pacific Islander, 5. Mentions Latino
       *            6. Mentions color other than black or white, 7. Other, 8. More than 2 mentions, 9. NA DK, 0. Inap.
  * 1992 - 1996: ethnicity (if/type of Spanish decent) then race, (race has same categories as previous waves)
  * 1997 - forward:  race (same categories), then ethnicity 
       *Ethnicity: 	1. American, 2.Hyphenated American (e.g., Afric-Amer, Mex-Amer), 3. National origin (French, etc.), 
	   *			4. Non-specific Hispanic (e.g., Latino), 5. Racial (wh/bl) 6. Religious (Jewish, Catholic, etc.)
	   *			7. Other, 8. DK, 9. NA; refused, 0. Inap
  
  replace racein`i'= racehdin`i' if head`i'==1
  replace racein`i'= racewfin`i' if wife`i'==1
  replace ethnicin`i'= ethnichdin`i' if head`i'==1
  replace ethnicin`i'= ethnicwfin`i' if wife`i'==1
  }
  // New race var: 1=White; 2=Black; 3=Hispanic; 4=Other
  forv i=1/17 {
   replace raceai`i'=1 if racein`i'==1
   replace raceai`i'=2 if racein`i'==2
   replace raceai`i'=3 if racein`i'==3
   replace raceai`i'=4 if racein`i'==7
   replace racehdai`i'=1 if racehdin`i'==1
   replace racehdai`i'=2 if racehdin`i'==2
   replace racehdai`i'=3 if racehdin`i'==3
   replace racehdai`i'=4 if racehdin`i'==7
   }
  
  forv i=18/24 {
   replace raceai`i'=3 if ethnicin`i'>0 & ethnicin`i'<9 
   replace raceai`i'=1 if racein`i'==1
   replace raceai`i'=2 if racein`i'==2
   replace raceai`i'=4 if racein`i'==3 | racein`i'==4 | racein`i'==5
   replace racehdai`i'=3 if ethnichdin`i'>0 & ethnichdin`i'<9   
   replace racehdai`i'=1 if racehdin`i'==1
   replace racehdai`i'=2 if racehdin`i'==2
   replace racehdai`i'=4 if racehdin`i'==3 | racehdin`i'==4 | racehdin`i'==5   
   }
  forv i=25/29 {
   replace raceai`i'=3 if ethnicin`i'>0 & ethnicin`i'<9 
   replace raceai`i'=1 if racein`i'==1
   replace raceai`i'=2 if racein`i'==2
   replace raceai`i'=4 if racein`i'==3 | racein`i'==4 | racein`i'==6 | racein`i'==7
   replace raceai`i'=3 if racein`i'==5   
   replace racehdai`i'=3 if ethnichdin`i'>0 & ethnichdin`i'<9   
   replace racehdai`i'=1 if racehdin`i'==1
   replace racehdai`i'=2 if racehdin`i'==2
   replace racehdai`i'=4 if racehdin`i'==3 | racehdin`i'==4 | racehdin`i'==6 | racein`i'==7
   replace racehdai`i'=3 if racehdin`i'==5
   }	
  forv i=30/$NW {
   replace raceai`i'=1 if racein`i'==1
   replace raceai`i'=2 if racein`i'==2
   replace raceai`i'=3 if racein`i'==5   
   replace raceai`i'=4 if racein`i'==3 | racein`i'==4 | racein`i'==6 | racein`i'==7
   replace racehdai`i'=1 if racehdin`i'==1
   replace racehdai`i'=2 if racehdin`i'==2
   replace racehdai`i'=3 if racehdin`i'==5
   replace racehdai`i'=4 if racehdin`i'==3 | racehdin`i'==4 | racehdin`i'==6 | racein`i'==7
   } 
forv i=18/$NW {
  replace colattendhd`i'=colattendhdin`i'
  replace colattendwf`i'=colattendwfin`i'
  replace colattend`i'  =colattendhdin`i' if head`i'==1
  replace colattendsp`i'=colattendwfin`i' if head`i'==1
  replace colattendsp`i'=colattendhdin`i' if wife`i'==1
  replace colattend`i'  =colattendwfin`i' if wife`i'==1
  }

***********************************************************************************;
*----------------------------- Time invariant demographics ------------------------;
*Create other new vars (for recodes)
gen birthyr=.
gen female=.
gen schlast=. 
gen racea=. 
gen raceaw=. 
gen raceab=. 
gen raceah=. 
gen raceao=. 
gen racehd=. 
gen racehdaw=. 
gen racehdab=. 
gen racehdah=. 
gen racehdao=.
gen test=.

*Recodes
replace female=1 if sex==2
replace female=0 if sex==1

forv i=$NW(-1)1 {
  replace birthyr=birthyr`i' if birthyr==. & birthyr`i'!=. & birthyr`i'!=0 & birthyr`i'!=9999
  replace schlast=sch`i' if schlast==. & sch`i'!=. 
  replace racea=raceai`i' if racea==. & raceai`i'!=.
  replace raceaw=1 if racea==1
  replace raceaw=0 if racea==2 | racea==3 | racea==4
  replace raceab=1 if racea==2 
  replace raceab=0 if racea==1 | racea==3 | racea==4
  replace raceah=1 if racea==3
  replace raceah=0 if racea==1 | racea==2 | racea==4
  replace raceao=1 if racea==4
  replace raceao=0 if racea==1 | racea==2 | racea==3
  replace racehd=racehdai`i' if racehd ==. & racehdai`i'!=.
  replace racehdaw=1 if racehd==1
  replace racehdaw=0 if racehd==2 | racehd==3 | racehd==4
  replace racehdab=1 if racehd==2 
  replace racehdab=0 if racehd==1 | racehd==3 | racehd==4
  replace racehdah=1 if racehd==3
  replace racehdah=0 if racehd==1 | racehd==2 | racehd==4
  replace racehdao=1 if racehd==4
  replace racehdao=0 if racehd==1 | racehd==2 | racehd==3
}

forv i=1/$NW {
 replace calcage`i'=${survyear`i'} - birthyr if birthyr!=. & ${survyear`i'} > birthyr 
}

*Sentence-completion test score (tested heads once in 1972);
replace test=v2949


***********************************************************************************;
*----------------------------- Geography -----------------------------------;
** NOTE: there are four regions in later years--not sure what Deb did;
set more off
*Create new vars (to hold orig values) & global for each set of variables
#delimit ;
newstubs geography
 "	regionin
 	cityin
 	statein 		
 	region
 	regionne
 	regionmw
 	regions
 	regionw
 	city				
 	state
 " ;  
*Create globals for original variables names
#delimit ;
gl regionin_orig
	v361    v876 
	v1572   v2284   v2911   v3279   v3699   v4178   v5054   v5633   v6180   v6773 
	v7419   v8071   v8695   v9381   v11028  v12379  v13631  v14678  v16152  v17538
	v18889  v20189  v21495  v23327  check   check   check   check   er16430	er20376
	er24143 er28042 er41032 er46974 er52398 er58215	er65451	er71530 er77591;
 *1. Yes, 5. No, 9. NA, 0. in city of 50K or foreign country; 
gl cityin_orig
	dummiss v807
	v1496 v2208 v2834 dummiss dummiss dummiss v4707 v5625 v6172 dummiss
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss ;
gl statein_orig
	v93		v537	
	v1103	v1803	v2403	v3003	v3403 		v3803		v4303 		v5203 		v5703 		v6303
	v6903	v7503	v8203	v8803 	v10003		v11103		v12503		v13703		v14803		v16303
	v17703	v19003	v20303	v21603	check		dummiss		dummiss		er10004		er13004		er17004
	er21003 er25003 er36003 er42003 er47303  	er53003		er60003		er66003 	er72003;
*At least in later years, this is the PSID code, not FIPS;	
#delimit cr
*Match up original vars with new vars (so col3 vars hold raw values)
convertnames regionin_orig regionin
convertnames cityin_orig cityin
convertnames statein_orig statein

*Recodes	
forv i=1/$NW {
   *1=northeast, 2=north central, 3=south, 4=west, 5=alaska, hawaii, 6=foreign country, 9=DK, refused;
   replace region`i'=regionin`i' if regionin`i'>=1 & regionin`i'<=6
   *Lumping alaska, hawaii into west;
   replace regionne`i'=1 if region`i'==1
   replace regionne`i'=0 if region`i'>=2 & region`i'<=6
   replace regionmw`i'=1 if region`i'==2
   replace regionmw`i'=0 if region`i'==1 | (region`i'>=3 & region`i'<=6)   
   replace regions`i'=1  if region`i'==3
   replace regions`i'=0  if region`i'==1 | region`i'==2 | (region`i'>=4 & region`i'<=6) 
   replace regionw`i'=1  if region`i'==4 | region`i'==5
   replace regionw`i'=0  if (region`i'>=1 & region`i'<=3) | region`i'==6
}
forv i=1/$NW {
	replace city`i'=1 if cityin`i'==1 | cityin`i'==0
	replace city`i'=0 if cityin`i'==5
}
forv i=1/$NW {
	replace state`i'=statein`i'
}


***********************************************************************************;
*---------------------- Marriage based on current report -----------;
*Create (empty) new vars 
#delimit ;
newstubs marriage	
"	marstathdin
	marstata
 	marstatb
 	married
 	nevmar
 	widow
 	div
 	sep
 	divsep
 " ;

*Create globals for original variables names
#delimit ;
gl marstathdin_orig
	v239   	v607   
	v1365	v2072	v2670	v3181	v3598	v4053	v4603	v5650	v6197  	v6790   
	v7435   v8087   v8711  	v9419  	v11065 	v12426 	v13665 	v14712 	v16187  v17565  
	v18916  v20216 	v21522 	v23336	er2014	er5013	er7013	er10016	er13021	er17024
	er21023 er25023 er36023 er42023 er47323 er53023 er60024 er66024 er72024 ;	
#delimit cr

*Match up original vars with new vars (so col3 vars hold raw values)
convertnames marstathdin_orig marstathdin 
set more off 
*Recodes
forv i=1/$NW {
  *** Marital status of head
  * Coding:  1. Married or permanently cohabiting, 2. Single, never legally married, 3. Widowed,
          *  4. Divorced, annulled 5. Separated (but legally married), 8=DK 9. NA (refused);
    replace marstata`i'=marstathdin`i' 	if marstathdin`i'>=1 & marstathdin`i'<=5 & (head`i'==1 | wife`i'==1)
    replace marstatb`i'=4 				if marstata`i'==5		& (head`i'==1 | wife`i'==1)
    replace marstatb`i'=marstata`i'		if marstata`i'~=5			& (head`i'==1 | wife`i'==1)
	
    replace married`i'=1		if marstathdin`i'==1				& (head`i'==1 | wife`i'==1) 
    replace married`i'=0		if inlist(marstathdin`i',2,3,4,5)	& (head`i'==1 | wife`i'==1) 
    replace nevmar`i'=1			if marstathdin`i'==2				& (head`i'==1 | wife`i'==1) 
    replace nevmar`i'=0			if inlist(marstathdin`i',1,3,4,5)	& (head`i'==1 | wife`i'==1) 
	replace widow`i'=1			if marstathdin`i'==3				& (head`i'==1 | wife`i'==1) 
	replace widow`i'=0			if inlist(marstathdin`i',1,2,4,5)	& (head`i'==1 | wife`i'==1) 
	replace div`i'=1			if marstathdin`i'==4				& (head`i'==1 | wife`i'==1) 
	replace div`i'=0			if inlist(marstathdin`i',1,2,3,5)	& (head`i'==1 | wife`i'==1) 
	replace sep`i'=1			if marstathdin`i'==5				& (head`i'==1 | wife`i'==1) 
	replace sep`i'=0			if inlist(marstathdin`i',1,2,3,4)	& (head`i'==1 | wife`i'==1) 
	replace divsep`i'=1			if inlist(marstathdin`i',4,5)		& (head`i'==1 | wife`i'==1) 
	replace divsep`i'=0			if inlist(marstathdin`i',1,2,3)		& (head`i'==1 | wife`i'==1) 
}

***********************************************************************************;
*----------------------------- Poverty ----------------------------;
*Create (empty) new vars 
#delimit ;
newstubs poverty_vars	
"	famincin	
	povcutin
	faminc			
	povcut			
	poverty			
	ipratio			
 " ;

*Create globals for original variables names
#delimit ;
gl famincin_orig		
	v81		v529   
	v1514	v2226	v2852	v3256	v3676	v4154	v5029	v5626	v6173	v6766   
	v7412   v8065   v8689  	v9375  	v11022 	v12371	v13623 	v14670 	v16144	v17533  
	v18875  v20175 	v21481 	v23322	er4153 	er6993 	er9244 	er12079 er16462 er20456
	er24099 er28037 er41027 er46935 er52343 er58152 er65349	er71426 er77448 ;
*Note: The 2003 and 2005 surveys collect this information for TWO years, so there are no gaps due to 
*	   biennial survey structure, but variables included here are only for those corresponding to the survey years;		
gl povcutin_orig	
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss
	v18884 	v20184 	v21490 	v23326	er4155	er6995	er9246	er12220	er16427	er20373
	er24140 er28039 er41029 er46972 er52396 er58214	er65449	er71528 er77589 ;	
#delimit cr

*Match up original vars with new vars (so col3 vars hold raw values)
convertnames famincin_orig famincin
convertnames povcutin_orig povcutin

*Recodes

forv i=1/$NW {
 replace faminc`i'=famincin`i'
 replace povcut`i'=povcutin`i'
 replace poverty`i'=1 						if faminc`i' < povcut`i' & (faminc`i'!=. & povcut`i'!=.)
 replace ipratio`i'=faminc`i'/povcut`i'		if (faminc`i'!=. & povcut`i'!=.)
}


***********************************************************************************;
*----------------------------- Home Ownersip ----------------------------;
*Create (empty) new vars 
#delimit ;
newstubs poverty	
"	homeownin
	homevalin
	homemortin
	homeloanin
	homemortbin
	homeown
	homeval			
	homemort		
	homeloan		
	homemortb		
	equity				
 " ;

*Create globals for original variables names
#delimit ;
gl homeownin_orig
	v103	v593   
	v1264	v1967	v2566	v3108	v3522	v3939	v4450	v5364	v5864 	v6479   
	v7084   v7675   v8364  	v8974  	v10437 	v11618 	v13023 	v14126 	v15140  v16641  
	v18072  v19372 	v20672 	v22427 	er2032	er5031 	er7031 	er10035 er13040 er17043
	er21042 er25028 er36028 er42029 er47329 check 	check 	check 	check ;  
	*own=1, rent=5;
gl homevalin_orig
	v5     	v449   
	v1122	v1823	v2423	v3021	v3417	v3817	v4318	v5217  	v5717  	v6319   
	v6917   v7517   v8217  	v8817  	v10018 	v11125 	v12524 	v13724 	v14824 	v16324  
	v17724  v19024 	v20324 	v21610 	er2033 	er5032 	er7032 	er10036 er13041	er17044
	er21043 er25029 er36029 er42030 er47330 check 	check 	check	check ;
#delimit ;
gl homemortin_orig
	v104	v594
	v1265	v1968	v2567	check	check	check	check	check	check	v6480	
	v7085	v7676	dummiss	v8975	v10438	v11619	v13024	v14127	v15141	v16642	
	v18073	v19373	v20673	v22428	er2036	er5035	er7050	er10039	er13044	er17049
	er21048 er25039 er36039 er42040 er47345 check 	check	check 	check ;
gl homeloanin_orig
	dummiss	v451
	v1124	v1825	v2425	check	check 	check	v4320	v5219	v5719	v6321	
	v6919	v7519	dummiss	v8819	v10020	v11127	v12526	v13726	v14826	v16326	
	v17726	v19026	v20326	v21612	er2037	er5036	er7042	er10044	er13047	er17052
	er21051 er25042 er36042 er42043 er47348 check 	check	check 	check ;
gl homemortbin_orig
	dummiss	v595
	v1266	v1971	v2570	check	check	check	check	check	check	v6482	
	v7087	v7678	dummiss	v8977	v10440	v11621	v13026	v14129	v15142	v16643	
	v18075	v19375	v20675	v22430	er2045	er5044	er7051	er10056	er13053	er17060
	er21059 er25050 er36051 er42059 er47366 check 	check 	check 	check ;
#delimit cr

*Match up original vars with new vars (so col3 vars hold raw values)
convertnames homeownin_orig 	homeownin
convertnames homevalin_orig 	homevalin
convertnames homemortin_orig 	homemortin
convertnames homeloanin_orig 	homeloanin
convertnames homemortbin_orig 	homemortbin

*Recodes
forv i=1/$NW {
	replace homeown`i'=1 if homeownin`i'==1
	replace homeown`i'=0 if homeownin`i'==5 | homeownin`i'==8
	replace homeval`i'=0 if homeown`i'==0 	
	replace homeval`i'=homevalin`i' if homevalin`i'!=.
	replace homemort`i'=1 if homemortin`i'==1
	replace homemort`i'=0 if homemortin`i'==5
	replace homeloan`i'=homeloanin`i'
	replace homemortb`i'=homemortbin`i'
	replace equity`i'=0 if homeown`i'==0
	replace equity`i'=homeval`i'-homeloan`i' if homeown`i'==1
}


***********************************************************************************;
*----------------------------- Employment ---------------------------;


#delimit cr
label define imputation 0 "Not imputed" 1 "xscid" 2 "xyrid" 3 "asgnd" 4 "htdck" 5 "medn" 6 "hand"
foreach var of global fix_str_to_num {
	cap noi drop temp
	gen temp=.
	replace temp=0 if `var'==""
	replace temp=1 if `var'=="xscid"
	replace temp=2 if `var'=="xyrid"
	replace temp=3 if `var'=="asgnd"
	replace temp=4 if `var'=="htdck"
	replace temp=5 if `var'=="medn"
	replace temp=6 if `var'=="hand"
	drop `var'
	gen `var'=temp
	label val `var' imputation
	}

*Create new (empty) variables
#delimit ;
newstubs employment
" 	yrsfthdin		
	yrsftwfin
	employhdin
	emplo2hdin
	emplo3hdin
	retirehdin				
	employwfin
	emplo2wfin
	emplo3wfin
	retirewfin
	earnwagehdin
	earnwagewfin
	earntothdin
	earntotwfin
	wagehdin
	wagewfin
	hourshdin
	hourswfin
	union1hdin
	union2hdin
	union3hdin
	empgovhdin
	union2wfin
	union3wfin
	empgovwfin
    occupationin
   yrsfthd 
   yrsftwf 
   employhd    
   emplo2hd
   emplo3hd 
   retirehd 
   employwf    
   emplo2wf    
   emplo3wf    
   retirewf
   earnwagehd  
   earnwagewf  
   earntothd   
   earntotwf
   wagehd
   wagewf
   hourshd
   hourswf
   union1hd
   union2hd
   union3hd
   empgovhd
   union2wf
   union3wf
   empgovwf
   occupation
   occupval
	   occdum1hd           
	   occdum2hd            
	   occdum3hd            
	   occdum4hd            
	   occdum5hd           
	   occdum6hd           
	   occdum7hd            
	   earnwage					
	   earnwagesp
	   earntot					
	   earntotsp 
	   wage						
	   wagesp 
	   hours             		
	   hourssp     
	   employ        			
	   emplo2 			
	   emplo3 			
	   employsp
	   emplo2sp
	   emplo3sp
	   lfwork        			
	   lfworksp
	   lflaid
	   lflaidsp
	   lfunemp
	   lfunempsp
	   lfretir
	   lfretirsp
	   lfhome
	   lfhomesp
	   lfdisab
	   lfdisabsp
	   lfstud
	   lfstudsp
	   lfother
	   lfothersp
	   empgov          			
	   empgovsp		
	   yrsft              		
	   yrsftsp
	   famearntot
	  famearntotreal			
	  earntotreal				
	  earntotspreal	
 acctxinchwin
 accadcin
 accadchdin
 accadcwfin
 acctransfhwin
 acctransfothin
 acctxincothin
 accassetinchwin
 inctaxtotin
 inctaxhwin
 inctaxothin
 accearntotin
 accearnwagein
 accearnothin
 accbnsin
 accotmin
 acctipin
 acccomin
 accprfin
 accmkgin
 accxtrin
 accothin
 accbusin
 accfrmin
accearnwagewfin
accbnswfin
accotmwfin
acctipwfin
acccomwfin
accprfwfin
accxtrwfin
accothwfin
 frmincin
 earnbusin
 accearntotwfin
 earnbuswfin
 occupationwfin
   acctxinchw
   accadc
   accadchd
   accadcwf
   acctransfhw
   acctransfoth
   acctxincoth
   accassetinchw
   inctaxtot
   inctaxhw
   inctaxoth
   accearntot
   accearnwage
   accearnoth
   accbns
   accotm
   acctip
   acccom
   accprf
   accmkg
   accxtr
   accoth
   accbus
   accfrm
   frminc
   earnbus
   accearntotwf
   earnbuswf
   occupationwf
    accadcsp
    accearntotsp
    accearnwagesp
    accearnothsp
    accbnssp
    accotmsp
    acctipsp
    acccomsp
    accprfsp
    accmkgsp
    accxtrsp
    accothsp
    accbussp
    accfrmsp
    frmincsp
    earnbussp  
acctrustwf
accintwf
accdivwf
accalimhd
acctrusthd
accinthd
accdividhd
accrenthd
acctnsfmiscwf
acchlpnonrelwf
acchlprelwf
accpenswf
accsswf
accothwelwf
accchsuppwf
accssiwf
accwrkcomwf
accunempwf
acctnsfmischd
acchlpnonrelhd
acchlprelhd
accchsupphd
accwrkcomhd
accunemphd
accotrethd
accirahd
accpenshd
accvapenshd
accsshd
accothwelhd
accssihd
acctxincofum
accearntotofum
accadcofum
accssiofum
accofumwelf
accofumss
accofumva
accofumret
accofumunemp
accofumwrkcmp
accofumchsupp
accofumhlprel
accofummisctr
accofumtanf
acchdwftaxin
acchdwftrans
accfamssi
accofumtrans
accwfothasset
acchdhlelse
accwfrent
accwfother
acchdira
accwfann
accwfira
accwfothpen
accofumothwelf
accspalim
accspva	
acctrustwfin
accintwfin
accdivwfin
accalimhdin
acctrusthdin
accinthdin
accdividhdin
accrenthdin
acctnsfmiscwfin
acchlpnonrelwfin
acchlprelwfin
accpenswfin
accsswfin
accothwelwfin
accchsuppwfin
accssiwfin
accwrkcomwfin
accunempwfin
acctnsfmischdin
acchlpnonrelhdin
acchlprelhdin
accchsupphdin
accwrkcomhdin
accunemphdin
accotrethdin
accirahdin
accpenshdin
accvapenshdin
accsshdin
accothwelhdin
accssihdin
accearntotofumin
accadcofumin
accssiofumin
accofumwelfin
accofumssin
accofumvain
accofumretin
accofumunempin
accofumwrkcmpin
accofumchsuppin
accofumhlprelin
accofummisctrin
accofumtanfin
accfamssiin
accwfothassetin
acchdhlelsein
accwfrentin
accwfotherin
acchdirain
accwfannin
accwfirain
accwfothpenin
accofumothwelfin
accspalimin
accspvain
acchourshdin
acchrsmainhdin
acchrsoverhdin
acchrsxtrahdin
accweekswrkhdin
accworkhrshdin
acchourswfin
acchrsmainwfin
acchrsoverwfin
acchrsxtrawfin
accweekswrkwfin
accworkhrswfin
 	" ;
* Globals for orig vars ;
#delimit ;
gl yrsfthdin_orig
  	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	v3621 	v4142 	v4631 	v5605 	v6154 	v6751
	v7384 	v8036 	v8660 	v9346 	v10993 	v11740 	v13606 	v14653 	v16127 	v17524
	v18855 	v20155 	v21461 	v23317 	er3986	er6856	er9102	er11898	er15980	er20041
	er23477	er27445 er40617 er46595 er51956 er57712	er64872	er70944 er76962 ;		
gl yrsftwfin_orig
    dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	v3611 	v4111 	v4990 	v5575 	v6124 	v6721
	v7354 	v8006 	v8630 	v9316 	v10963 	v12103 	v13532 	v14579 	v16053 	v17450
	v18781 	v20081 	v21387 	v23244 	er3916 	er6786 	er9032 	er11810 er15887 er19948
	er23385 er27349 er40524 er46501 er51862 er57602	er64733	er70806 er76817 ;
gl employhdin_orig
    v196	v639
	v1278	v1983	v2581	v3114	v3528	v3967	v4458	v5373	v5872	v6492
	v7095	v7706	v8374	v9005	v10453	v11637	v13046	v14146	v15154	v16655	
	v18093	v19393	v20693	v22448	er2068	er5067	er7163	er10081 er13205 er17216
	er21123 er25104 er36109 er42140 er47448 er53148 er60163 er66164 er72164 ;
gl emplo2hdin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss er10082 er13206 er17217
	er21124 er25105 er36110 er42141 er47449 er53149 er60164 er66165 er72165 ;
gl emplo3hdin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss er10083 er13207 er17218
	er21125 er25106 er36111 er42142 er47450 er53150 er60165 er66166 er72166 ;
gl retirehdin_orig
	dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss v6003 	v6576
	v7178 	v7864 	v8524 	v9174 	v10657 	v11638 	v13047 	v14147 	v15155 	v16656
	v18094 	v19394 	v20694 	v22449 	er2072 	er5071 	er7167 	er10084 er13208 er17219
	er21126 er25107 er36112 er42143 er47451 er53151 er60166 er66167 er72167 ;	
gl employwfin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	v4841	dummiss	dummiss	v6591	
	v7193	v7879	v8538	v9188	v10671	v12000	v13225	v14321	v15456	v16974	
	v18395	v19695	v20995	v22801	er2563	er5562	er7658	er10563 er13717 er17786
	er21373 er25362 er36367 er42392 er47705 er53411	er60426	er66439 er72441 ; 
gl emplo2wfin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss er10564 er13718 er17787
	er21374 er25363 er36368 er42393 er47706 er53412	er60427	er66440 er72442 ;  
gl emplo3wfin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss er10565 er13719 er17788
	er21375 er25364 er36369 er42394 er47707 er53413	er60428	er66441 er72443 ;  
gl retirewfin_orig
	dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss v6648
	v7250 	v7941 	v8592 	v9265 	v10854 	v12001 	v13226 	v14322 	v15457 	v16975
	v18396 	v19696 	v20996 	v22802 	er2566 	er5565 	er7661 	er10566 er13720 er17789
	er21376 er25365 er36370 er42395 er47708 er53414	er60429	er66442 er72444  ;
gl earnwagehdin_orig
	dummiss dummiss   
	v1191	v1892	v2493	v3046	v3458	v3858	v4373	v5283	v5782	v6391   
	v6981   v7573   v8265  	v8873  	v10256 	v11397 	v12796 	v13898 	v14913 	v16413  
	v17829  v19129 	v20429 	v21739	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss
	er21929 er25910 er36928 er42919 er48241 er53935	er60994	er67046 er73069 ;  
	* NOTE: Only bracked values available for 1968 and 1969;
gl earnwagewfin_orig
	check 	check
	check 	check 	check 	check 	check 	check 	check 	check 	check 	check
	check 	check 	check 	check 	check 	check 	check 	check 	check 	check
	check 	check 	check 	check 	er3479 	er6480 	er8597 	er11491 er14757 er18930
	er22300 er26281 er37299 er43290 er48615 er54309	er61349 er67401 er73424 ;
gl earntothdin_orig
	v74    	v514   
	v1196	v1897	v2498	v3051	v3463	v3863	v5031	v5627  	v6174  	v6767   
	v7413  	v8066  	v8690  	v9376  	v11023 	v12372 	v13624 	v14671 	v16145 	v17534  
	v18878 	v20178 	v21484 	v23323	er4140	er6980	er9231	er12080	er16463	er20443
	er24116	er27931	er40921	er46829	er52237	er58038	er65216	er71293 er77315 ;  
	*1994-forward excludes farm and business labor income;
	*2019 -- need to double check comparability of income definition to 2017 and earlier;
gl earntotwfin_orig
	v75    	v516   
	v1198	v1899	v2500	v3053	v3465	v3865	v4379	v5289  	v5788  	v6398   
	v6988   v7580   v8273  	v8881  	v10263 	v11404 	v12803 	v13905 	v14920  v16420  
	v17836  v19136 	v20436 	v23324	er4144	er6984	er9235	er12082	er16465	er20447
	er24135 er27943 er40933 er46841 er52249 er58050	er65244	er71321 er77343 ;	 
gl wagehdin_orig
	v337    v871
	v1567   v2279   v2906   v3275   v3695   v4174   v5050   v5631   v6178   v6771 
	v7417   v8069   v8693   v9379   v11026  v12377  v13629  v14676  v16150  v17536
	v18887	v20187	v21493  check   check   check   check   check   check   check
	er24137 er28003 er40993 er46901 er52309 er58118	er65315	er71392 er77414 ;
gl wagewfin_orig
	v338    v873 
	v1569   v2281   v2908   v3277   v3697   v4176   v5052   v5632   v6179   v6772 
	v7418   v8070   v8694   v9380   v11027  v12378  v13630  v14677  v16151  v17537
	v18888	v20188	v21494  check   check   check   check   check   check   check
	er24138	er28004 er40994 er46902 er52310 er58119	er65316	er71393 er77415 ;
gl hourshdin_orig
	v47     v465 
	v1138   v1839   v2439   v3027   v3423   v3823   v4332   v5232   v5731   v6336 
	v6934   v7530   v8228   v8830   v10037  v11146  v12545  v13745  v14835  v16335
	v17744  v19044  v20344  v21634  er4096	er6936	er9187	er12174	er16471	er20399
	er24080 er27886 er40876 er46767 er52175 er57976	er65156	er71233 er77255 ;
gl hourswfin_orig
	v53     v475    
	v1148   v1849   v2449   v3035   v3431   v3831   v4344   v5244  	v5743   v6348   
	v6946   v7540   v8238   v8840   v10131  v11258  v12657  v13809  v14865  v16365
	v17774  v19074  v20374  v21670  er4107	er6947	er9198	er12185	er16482	er20410
	er24091	er27897 er40887 er46788 er52196 er57997	er65177	er71254 er77276 ;
gl acchourshdin_orig
	v48		v466	
	v1139	v1840	v2440	v3028	v3424	v3824	v4333	v5233	v5732	v6337	
	v6935	v7531	v8229	v8831	v10038	dummiss	dummiss	dummiss	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss
	dummiss	dummiss dummiss dummiss dummiss dummiss	dummiss	dummiss dummiss ;	
gl acchrsmainhdin_orig
	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	v10034	v11141	v12540	v13740	v14830	v16330	
	v17739	v19039	v20339	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss
	dummiss	dummiss dummiss dummiss dummiss dummiss	dummiss	dummiss	dummiss ;
gl acchrsoverhdin_orig
	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	v11143	v12542	v13742	v14832	v16332	
	v17741	v19041	v20341	v21631	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss
	dummiss	dummiss dummiss	er46766	er52174	er57975	er65155	er71232 er77254 ;
gl acchrsxtrahdin_orig
	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	v10036	v11145	v12544	v13744	v14834	v16334	
	v17743	v19043	v20343	v21633	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss dummiss dummiss dummiss dummiss	dummiss	dummiss	dummiss ;
gl accweekswrkhdin_orig
	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	er46762	er52170	er57971	er65151	er71228 er77250 ;	
gl accworkhrshdin_orig
	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	er46764	er52172	er57973	er65153	er71230 er77252 ;	
gl acchourswfin_orig
	v54		v476
	v1149	v1850	v2450	v3036	v3432	v3832	v4345	v5245	v5744	v6349
	v6947	v7541	v8239	v8841	v10132	dummiss	dummiss	dummiss	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss
	dummiss	dummiss dummiss dummiss dummiss dummiss	dummiss	dummiss dummiss ;
gl acchrsmainwfin_orig
	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	v10128	v11253	v12652	v13804	v14860	v16360	
	v17769	v19069	v20369	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss
	dummiss	dummiss dummiss dummiss dummiss dummiss	dummiss	dummiss	dummiss ;
gl acchrsoverwfin_orig
	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	v11255	v12654	v13806	v14862	v16362	
	v17771	v19071	v20371	v21667	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss
	dummiss	dummiss dummiss	er46787	er52195	er57996	er65176	er71253 er77275 ;
gl acchrsxtrawfin_orig	
	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	v10130	v11257	v12656	v13808	v14864	v16364
	v17773	v19073	v20373	v21669	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss dummiss dummiss dummiss dummiss	dummiss	dummiss	dummiss ;
gl accweekswrkwfin_orig
	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	er46783	er52191	er57992	er65172	er71249 er77271 ;
gl accworkhrswfin_orig
	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	er46785	er52193	er57994	er65174	er71251 er77273 ;	
gl union1hdin_orig
	v294	v766
	v1434	v2145	v2787	dummiss	v3636	v4087	v4624	v5559	v6101	v6707	
	v7340	v7971	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss
	dummiss	dummiss dummiss dummiss dummiss check	check	check 	check ;	
gl union2hdin_orig
	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	v4478	v5382	v5877	v6495	
	v7098	v7709	v8377	v9008	v10458	v11649	v13052	v14152	v15160	v16661	
	v18099	v19399	v20699	v22454	er2079 	er5078 	er7174 	er10089 er13213 er17224
	er21150	er25138 er36143 er42178 er47491 check	check	check  	check ;
gl union3hdin_orig
	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	v4479	v5383	v5878	v6496	
	v7099	v7710	v8378	v9009	v10459	v11650	v13053	v14153	v15161	v16662	
	v18100	v19400	v20700	v22455	er2080 	er5079 	er7175 	er10090 er13214 er17225
	er21151	er25139 er36144 er42179 er47492 check	check	check  	check ;
gl empgovhdin_orig
	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	v3971 	v4462 	v5377 	v5876 	v6494
	v7097 	v7708 	v8376 	v9007 	v10457 	v11648 	v13051 	v14151 	v15159 	v16660
	v18098 	v19398 	v20698 	v22453 	er2078 	er5077 	er7173 	er10088 er13212 er17223
	er21149	er25131 er36136 er42171 er47484 check	check	check  	check ;
gl union2wfin_orig		
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	v4861	dummiss	dummiss	v6594	
	v7196	v7882	v8541	v9191	v10676	v12012	v13231	v14327	v15462	v16980	
	v18401	v19701	v21001	v22807	er2574	er5573	er7669	er10572	er13725	er17795
	er21400	er25396 er36401 er42430 er47748 check	check	check  	check ;
gl union3wfin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	v4862	dummiss	dummiss	v6595	
	v7197	v7883	v8542	v9192	v10677	v12013	v13232	v14328	v15463	v16981	
	v18402	v19702	v21002	v22808	er2573	er5572	er7668	er10571	er13726	er17794
	er21401	er25397 er36402 er42431 er47749 check	check	check  	check ;
gl empgovwfin_orig
	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss v4845 	dummiss	dummiss v6593
	v7195 	v7881 	v8540 	v9190 	v10675 	v12011 	v13230 	v14326 	v15461 	v16979
	v18400 	v19700 	v21000 	v22806 	er2572 	er5571 	er7667 	er10570 er13724 er17793
	er21399 er25389 er36394 er42423 er47741 check	check	check  	check ;
gl occupationin_orig
  v197    v640
  v1279   v1984   v2582   v3115   v3530   v3968   v4459   v5374   v5873   v6497
  v7100   v7712   v8380   v9011   v10460  v11651  v13054  v14154  v15162  v16663
  v18101  v19401  v20701  v22456  er4017  er6857  er9108  er12085 er13215 er17226
  er21145 er25127 er36132 er42167 er47479 er53179 er60194 er66195 er72195 ; 	
  ** NOTE: 1 digit for 68-75, 2 digit for 76-80, 3 digit for 81-2015, 4 digit for 2017-	;
gl acctxinchwin_orig	
	dummiss dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss check	check	check 	check ;
gl accadcin_orig	
	dummiss	v524
	v1210	v1912	v2513	v3066	v3478	v3878	v4393	v5304	v5803	v6414
	v7004	v7596	v8289 	v8897 	v10283 	v11428 	v12827	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss check	check	check 	check ;
gl accadchdin_orig		
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	v13929	v14944	v16444	
	v17860	v19160	v20460	v21979	dummiss	dummiss	dummiss	dummiss	dummiss	er18700
	er22072 er26053 er37071 er43062 er48384 er54062 er61104 er67156 er73179 ;
gl accadcwfin_orig		
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	v13950	v14965	v16465	
	v17881	v19181	v20481	v22253 dummiss dummiss dummiss dummiss dummiss er19049
	er22422 er26403 er37421 er43412 er48737 er54432 er61508 er67511 er73534 ;
gl acctransfhwin_orig	
	v90 v526	
	v1219	v1921	v2522	v3075	v3487	v3888	v4403	v5315	v5814	v6425	
	v7015	v7607	v8300	v8908	v10304	v11460	v12867	v13969	v14984	v16484	
	v17900	v19200	v20500	dummiss	dummiss	dummiss	dummiss	er12072	er16455	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss check ;	
gl acctxincothin_orig	
	v88 v522	
	v1223	v1925	v2526	v3079	v3491	v3892	v4407	v5319	v5818	v6429	
	v7034	v7626	v8319	v8927	v10383	v11562	v12969	v14071	v15086	v16586	
	v18002	v19302	v20602	v22372	dummiss	dummiss	dummiss	er12074	er16457	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss dummiss dummiss dummiss check ;	
gl acctransfothin_orig	
	dummiss v528	
	v1226	v1928	v2529	v3082	v3494	v3906	v4420	v5333	v5832	v6443	
	v7047	v7639	v8332	v8940	v10397	v11578	v12985	v14087	v15102	v16602	
	v18018	v19318	v20618	dummiss	dummiss	dummiss	dummiss	er12076	er16459	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss check ;		
gl accassetinchwin_orig	
	v87 	v519
	v1206	v1907	v2508	v3061	v3473	v3873	v4387	v5298	v5797	v6407
	v6997	v7589	v8282	v8890	v10276	v11418	v12817	v13919	v14934	v16434
	v17850	v19150	v20450	dummiss	dummiss	dummiss	dummiss	er12070	er16453	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss check ;		
gl inctaxtotin_orig	
	v83		v532 	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss check	check	check 	check ;
gl inctaxhwin_orig	
	dummiss	dummiss
	v1208	v1910	v2511	v3064	v3476	v3876	v4390	v5301	v5800	v6411	
	v7399	v8052	v8676	v9362	v11009	v12358	v13610	v14657	v16131	v17528	
	v18862	v20162	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss check	check	check 	check ;
gl inctaxothin_orig	
	dummiss	dummiss
	v1224	v1926	v2527	v3080	v3492	v3893	v4409	v5321	v5820	v6431
	v7411	v8064	v8688	v9374	v11021	v12370	v13622	v14669	v16143	v17532
	v18874	v20174	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss check	check	check 	check ;
gl accearntotin_orig
	v85		v515
	v1197	v1898	v2499	v3052	v3464	v3864	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss dummiss ;
gl accearnwagein_orig
	dummiss	dummiss
	v1192	v1893	v2494	v3047	v3459	v3859	v4374	v5284	v5783	v6392	
	v6982	v7574	v8266	v8874	v10257	v11398	v12797	v13899	v14914	v16414	
	v17830	v19130	v20430	v21740	er4123	er6963	er9214	er12197	er16494	er20426	
	er24118	er27914	er40904	er46812	er52220	er58021	er65201	er71278 er77300 ;	
gl accearnothin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	v4378	v5288	v5787	v6397	
	v6987	v7579	v8271	v8879	v10262	v11403	v12802	v13904	v14919	v16419	
	v17835	v19135	v20435	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss dummiss dummiss dummiss dummiss ;
gl accbnsin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	v21742	er4125	er6965	er9216	er12199	er16496	er20428 
	er24120 er27916 er40906 er46814 er52222 er58023	er65203	er71280 er77302 ;
gl accotmin_orig	
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	v21744	er4127	er6967	er9218	er12201	er16498	er20430
	er24122	er27918	er40908	er46816	er52224 er58025	er65205	er71282 er77304 ;
gl acctipin_orig	
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	v21746	er4129	er6969	er9220	er12203	er16500	er20432
	er24124	er27920	er40910	er46818	er52226 er58027	er65207	er71284 er77306 ;	
gl acccomin_orig	
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	v21748 er4131	er6971	er9222	er12205	er16502	er20434
	er24126	er27922	er40912	er46820	er52228 er58029	er65209	er71286 er77308 ;	
gl accprfin_orig	
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	v21766	er4133	er6973	er9224	er12207	er16504	er20436
	er24128	er27924	er40914	er46822	er52230 er58031	er65211	er71288 er77310 ;	
gl accmkgin_orig	
	dummiss dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	v21782  er4135	er6975	er9226	er12209	er16506	er20438
	er24130	er27926	er40916	er46824	er52232 er58033 dummiss dummiss dummiss ;	
gl accxtrin_orig	
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	v21802  er4139	er6979	er9230	er12213	er16510	er20442
	er24132	er27928	er40918	er46826	er52234 er58035	er65213	er71290 er77312 ;	
gl accothin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	v21750	er4137	er6977	er9228	er12211	er16508	er20440
	er24134	er27930	er40920	er46828	er52236 er58037	er65215	er71292 er77314 ;	
gl accbusin_orig	
	dummiss 	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	v21735 er4115	er6955	er9206	er12068	er16451	er20418
	er24108	er27906	er40896	er46804	er52212 er58013	er65193	er71270 er77292 ;	
gl accfrmin_orig	
	dummiss 	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss dummiss	
	dummiss	dummiss	dummiss	v21732	er4118	er6958	er9209	er12066	er16449	er20421
	er24106	er27909	er40899	er46807	er52215 er58016 er65196	er71273 er77295 ;
gl accearnwagewfin_orig
	dummiss	dummiss 	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss dummiss er65229	er71306 er77328 ;
gl accbnswfin_orig
	dummiss	dummiss 	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss dummiss er65231	er71308 er77330 ;

gl accotmwfin_orig
	dummiss	dummiss 	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss dummiss er65233	er71310 er77332 ;

gl acctipwfin_orig
	dummiss	dummiss 	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss dummiss er65235	er71312 er77334 ;
	
gl acccomwfin_orig
	dummiss	dummiss 	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss dummiss er65237	er71314 er77336 ;
	
gl accprfwfin_orig
	dummiss	dummiss 	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss dummiss er65239	er71316 er77338 ;
	
gl accxtrwfin_orig
	dummiss	dummiss 	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss dummiss er65241	er71318 er77340 ;
	
gl accothwfin_orig
	dummiss	dummiss 	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss dummiss er65243	er71320 er77342 ;
gl frmincin_orig
	v249	v695
	v1189	v1890	v2491	v3044	v3456	v3856	v4371	v5281	v5780	v6389	
	v6979	v7571	v8263	v8871	v11395	v11395	v12794	v13896	v14911	v16411	
	v17827	v19127	v20427	v21733	er4117	er6957	er9208	er12065	er16448	er20420
	er24105	er27908	er40898	er46806	er52214 er58015 er65195 er71272 er77294 ;
* farm income is bracketed before 1976 survey & includes both labor/asset income from 2003 onward ;	
* farm income also changes in later years to include HEAD AND WIFE farm income ;
gl earnbusin_orig	
	dummiss v697	
	v1190	v1891	v2492	v3045	v3457	v3857	v4372	v5282	v5781	v6390	
	v6980	v7572	v8264	v8872	v10255	v11396	v12795	v13897	v14912	v16412	
	v17828	v19128	v20428	v21738	er4119	er6959	er9210	er12193	er16490	er20422
	er24109 er27910	er40900	er46808	er52216 er58017 er65197 er71274 er77296 ; 
* business income is bracketed before 1976 survey ;
gl accearntotwfin_orig	
	v86		v517	
	v1199	v1900	v2501	v3054	v3466	v3866	v4380	v5290	v5789	v6399	
	v6989	v7581	v8274	v8882	v10264	v11405	v12804	v13906	v14921	v16421	
	v17837	v19137	v20437	v21808	er4145	er6985	er9236	er12083	er16466	er20448
	er24136	er27944	er40934	er46842	er52250 er58051 dummiss dummiss dummiss ;	
gl earnbuswfin_orig
	dummiss 	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	v21806 	er4141	er6981	er9232	er12214	er16511	er20444
	er24111	er27940	er40930	er46838	er52246 er58047	er65225	er71302 er77324 ;	
gl acctrustwfin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v21942 dummiss dummiss dummiss dummiss dummiss er19000
	er22389 er26370 er37388 er43379 er48704 er54398 er61474 er67494 er77351 ;
gl accintwfin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v21926 	dummiss dummiss dummiss dummiss dummiss er18984
	er22372 er26353 er37371 er43362 er48687 er54381 er61457 er67477 er77349 ;
gl accdivwfin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v21910 	dummiss dummiss dummiss dummiss dummiss er18968
	er22355 er26336 er37354 er43345 er48670 er54364 er61440 er67460 er77347 ;
gl accalimhdin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v21894 	dummiss dummiss dummiss dummiss  dummiss er18865
	er22235 er26216 er37234 er43225 er48550 er54244 er61286 er67338 er73361 ;
gl acctrusthdin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v21878 	dummiss dummiss dummiss dummiss dummiss er18684
	er22056 er26037 er37055 er43046 er48368 er54045 er61087 er67139 er73162 ;
gl accinthdin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v21862 	dummiss dummiss dummiss dummiss dummiss er18668
	er22039  er26020 er37038 er43029 er48351 er54028 er61070 er67122 er77321 ;
gl accdividhdin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v21846 	dummiss dummiss dummiss dummiss dummiss er18652
	er22022 er26003 er37021 er43012 er48334 er54011 er61053 er67105 er73128 ;
gl accrenthdin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v21830 	dummiss dummiss dummiss dummiss dummiss er18636
	er22005 er25986 er37004 er42995 er48317 er53994 er61036 er67088 er73111;
gl acctnsfmiscwfin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22365 	dummiss dummiss dummiss dummiss dummiss er19145
	dummiss er28001 er40991 er46899 er52307 er58116 er65313 er71390 er77412 ;
gl acchlpnonrelwfin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22350 	dummiss dummiss dummiss dummiss dummiss er19129
	er22502 er26483 er37501 er43492 er48817 er54560 er61671 er67724 er73747 ;
gl acchlprelwfin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22334 	dummiss dummiss dummiss dummiss dummiss er19113
	er22486 er26467 er37485 er43476 er48801 er54544 er61655 er67708 er77408 ;
gl accpenswfin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22318 	dummiss dummiss dummiss dummiss dummiss er19097
	er22470 er26451 er37469 er43460 er48785 er54480 er61591 er67579 er73602 ;
gl accsswfin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22303 	dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss er28034 er41024 er46932 er52340 er58149 er65346 er71423 er77445 ;
gl accothwelwfin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22285 	dummiss dummiss dummiss dummiss dummiss er19081
	er22454 er26435 er37453 er43444 er48769 er54464 er61540 er67544 er73567 ;
gl accchsuppwfin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22269 	dummiss dummiss dummiss dummiss dummiss er19065
	er22438 er26419 er37437 er43428 er48753 er54448 er61524 er67676 er73699 ;
gl accssiwfin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22237 	dummiss dummiss dummiss dummiss dummiss er19033
	er22406 er26387 er37405 er43396 er48721 er54416 er61492 er67528 er73551 ;
gl accwrkcomwfin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22221 	dummiss dummiss dummiss dummiss dummiss er18952
	er22322 er26303 er37321 er43312 er48637 er54331 er61407 er67660 er73683 ;
gl accunempwfin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22205 	dummiss dummiss dummiss dummiss dummiss er18936
	er22306 er26287 er37305 er43296 er48621 er54315 er61391 er67644 er73667 ;
gl acctnsfmischdin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22188 	dummiss dummiss dummiss dummiss dummiss er18913
	dummiss er27981 er40971 er46879 er52287 er58090 er65283 er71360 er77382 ;
gl acchlpnonrelhdin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22173 	dummiss dummiss dummiss dummiss dummiss er18897
	er22267 er26248 er37266 er43257 er48582 er54276 er61318 er67370 er73393 ;
gl acchlprelhdin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22157 	dummiss dummiss dummiss dummiss dummiss er18881
	er22251 er26232 er37250 er43241 er48566 er54260 er61302 er67354 er73377 ;
gl accchsupphdin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22141 	dummiss dummiss dummiss dummiss dummiss er18849
	er22219 er26200 er37218 er43209 er48534 er54228 er61270 er67322 er73345 ;
gl accwrkcomhdin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22125 	dummiss dummiss dummiss dummiss dummiss dummiss
	er22203 er26184 er37202 er43193 er48518 er54212 er61254 er67306 er73329 ;
gl accunemphdin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22109 	dummiss dummiss dummiss dummiss dummiss er18817
	er22187 er26168 er37186 er43177 er48502 er54196 er61238 er67290 er77370 ;
gl accotrethdin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22092 	dummiss dummiss dummiss dummiss dummiss dummiss
	er22170 er26151 er37169 er43160 er48485 er54163 er61205 er67257 er73280 ;
gl accirahdin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22076 	dummiss dummiss dummiss dummiss dummiss er18784
	er22154 er26135 er37153 er43144 er48469 er54147 er61189 er67241 er73264;
gl accpenshdin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22060 	dummiss dummiss dummiss dummiss dummiss er18768
	er22138 er26119 er37137 er43128 er48453 er54131 er61173 er67225 er73248 ;
gl accvapenshdin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22044 	dummiss dummiss dummiss dummiss dummiss er18752
	er22122  er26103 er37121 er43112 er48437 er54115 er61157 er67209 er73232 ;
gl accsshdin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22028 	dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss er28032 er41022 er46930 er52338 er58147 er65344 er71421 er77443 ;
gl accothwelhdin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22011 	dummiss dummiss dummiss dummiss dummiss er18733
	er22105 er26086 er37104 er43095 er48417 er54095 er61137 er67189 er73212 ;
gl accssihdin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v21995 	dummiss dummiss dummiss dummiss dummiss er18717
	er22089 er26070 er37088 er43079 er48401 er54079 er61121 er67173 er73196 ;
gl accearntotofumin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22368 	dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss ;
gl accadcofumin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22375 	dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss er28011 dummiss dummiss dummiss dummiss dummiss dummiss dummiss;
gl accssiofumin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22377 	dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss er28013 er41003 er46911 er52319 er58128 er65325 er71402 er77424 ;
gl accofumwelfin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22379 	dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss er28015 er41005 er46913 er52321 dummiss dummiss dummiss dummiss ;
gl accofumssin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22381 dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss er28036 er41026 er46934 er52342 er58151 er65348 er71425 er77447 ;
gl accofumvain_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22383 dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss er28017 er41007 er46915 er52323 er58132 er65329 er71406 er77428 ;
gl accofumretin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22385  dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss er28019 er41009 er46917 er52325 er58134 er65331 er71408 er77430 ;
gl accofumunempin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22387 dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss er28021 er41011 er46919 er52327 er58136 er65333 er71410 er77432 ;
gl accofumwrkcmpin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22389 	dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss er28023 er41013 er46921 er52329 er58138 er65335 er71412 er77434 ;
gl accofumchsuppin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22391 	dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss er28025 er41015 er46923 er52331 er58140 er65337 er71414 er77436 ;
gl accofumhlprelin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22393 	dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss er28027 er41017 er46925 er52333 er58142 er65339 er71416 er77438 ;
gl accofummisctrin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss v22395 	dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss er28029 er41019 er46927 er52335 er58144 er65341 er71418 er77440 ;
gl accofumtanfin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss dummiss er41001 er46909 er52317 er58126 er65323 er71400 er77422 ;
gl accfamssiin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss er12078 er16461 dummiss
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss ;
gl accwfothassetin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss er19016
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss ;
gl acchdhlelsein_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss
	er22283 er26264 er37282 er43273 er48598 er54292 er61334 er67386 er73409 ;
gl accwfrentin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss
	er22338 er26319 er37337 er43328 er48653 er54347 er61423 er67443 er73466 ;
gl accwfotherin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss
	er22518 er26499 er37517 er43508 er48833 er54576 er61687 er67740 er73763 ;
gl acchdirain_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss er54179 er61221 er67273 er73296 ;
gl accwfannin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss er54496 er61607 er67595 er73618 ;
gl accwfirain_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss er54512 er61623 er67627 er73650 ;
gl accwfothpenin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss er54528 er61639 er67611 er73634 ;
gl accofumothwelfin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss er58130 er65327 er71404 er77426 ;
gl accspalimin_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss dummiss er61556 er67692 er77406 ;
gl accspvain_orig
	dummiss	dummiss
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	
	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss	dummiss dummiss	dummiss	dummiss	
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss dummiss er61575 er67563 er77390 ;
		
gl occupationwfin_orig
	v243	v609	
	v1367	v2074	v2672	v3183	v3601	v4055	v4605	v5507	v6039	v6596	
	v7198	v7885	v8594	v9267	v10757	v12014	v13233 	v14329	v15464	v16982	
	v18403	v19703	v21003	v22809	er4048 	er6888	er9139	er12116	er13727	er17796	
	er21395	er25385	er36390	er42419	er47736 er53442	er60457	er66470 er72472 ;
*1968-1975 1-digit occupation, 1976-1979 2-digit occupation, 1980-2017 3-digit occup, 4-digit occup 2017- ;



#delimit cr

*Match up original vars with new vars (so col3 vars hold raw values);
convertnames yrsfthdin_orig 	yrsfthdin
convertnames yrsftwfin_orig 	yrsftwfin
convertnames employhdin_orig 	employhdin
convertnames emplo2hdin_orig 	emplo2hdin
convertnames emplo3hdin_orig 	emplo3hdin
convertnames retirehdin_orig 	retirehdin
convertnames employwfin_orig 	employwfin
convertnames emplo2wfin_orig 	emplo2wfin
convertnames emplo3wfin_orig 	emplo3wfin
convertnames retirewfin_orig 	retirewfin
convertnames earnwagehdin_orig 	earnwagehdin
convertnames earnwagewfin_orig 	earnwagewfin
convertnames earntothdin_orig 	earntothdin
convertnames earntotwfin_orig 	earntotwfin
convertnames wagehdin_orig 		wagehdin
convertnames wagewfin_orig 		wagewfin
convertnames hourshdin_orig 	hourshdin
convertnames hourswfin_orig 	hourswfin
convertnames union1hdin_orig 	union1hdin
convertnames union2hdin_orig 	union2hdin
convertnames union3hdin_orig 	union3hdin
convertnames empgovhdin_orig 	empgovhdin
convertnames union2wfin_orig 	union2wfin
convertnames union3wfin_orig 	union3wfin
convertnames empgovwfin_orig 	empgovwfin
convertnames occupationin_orig 	occupationin

convertnames acctxinchwin_orig 	acctxinchwin
convertnames accadcin_orig 		accadcin
convertnames acctransfhwin_orig acctransfhwin
convertnames acctransfothin_orig acctransfothin
convertnames acctxincothin_orig acctxincothin
convertnames accassetinchwin_orig accassetinchwin
convertnames inctaxtotin_orig 	inctaxtotin
convertnames inctaxhwin_orig 	inctaxhwin
convertnames inctaxothin_orig 	inctaxothin
convertnames accearntotin_orig 	accearntotin
convertnames accearnwagein_orig accearnwagein
convertnames accearnothin_orig accearnothin
convertnames accbnsin_orig accbnsin
convertnames accotmin_orig accotmin
convertnames acctipin_orig acctipin
convertnames acccomin_orig acccomin
convertnames accprfin_orig accprfin
convertnames accmkgin_orig accmkgin
convertnames accxtrin_orig accxtrin
convertnames accothin_orig accothin
convertnames accbusin_orig accbusin
convertnames accfrmin_orig accfrmin
convertnames frmincin_orig frmincin
convertnames earnbusin_orig earnbusin

convertnames accadchdin_orig accadchdin
convertnames accadcwfin_orig accadcwfin
convertnames earnbuswfin_orig earnbuswfin
convertnames accearntotwfin_orig accearntotwfin
convertnames occupationwfin_orig occupationwfin

convertnames accearnwagewfin_orig accearnwagewfin
convertnames accbnswfin_orig accbnswfin
convertnames accotmwfin_orig accotmwfin
convertnames acctipwfin_orig acctipwfin
convertnames acccomwfin_orig acccomwfin
convertnames accprfwfin_orig accprfwfin
convertnames accxtrwfin_orig accxtrwfin
convertnames accothwfin_orig accothwfin


convertnames acctrustwfin_orig 	acctrustwfin
convertnames accintwfin_orig 		accintwfin
convertnames accdivwfin_orig 		accdivwfin
convertnames accalimhdin_orig 		accalimhdin
convertnames acctrusthdin_orig 		acctrusthdin
convertnames accinthdin_orig 		accinthdin
convertnames accdividhdin_orig	 	accdividhdin
convertnames accrenthdin_orig 		accrenthdin
convertnames acctnsfmiscwfin_orig 	acctnsfmiscwfin
convertnames acchlpnonrelwfin_orig 	acchlpnonrelwfin
convertnames acchlprelwfin_orig 	acchlprelwfin
convertnames accpenswfin_orig 		accpenswfin
convertnames accsswfin_orig 		accsswfin
convertnames accothwelwfin_orig 	accothwelwfin
convertnames accchsuppwfin_orig 	accchsuppwfin
convertnames accssiwfin_orig 		accssiwfin
convertnames accwrkcomwfin_orig 	accwrkcomwfin
convertnames accunempwfin_orig 		accunempwfin
convertnames acctnsfmischdin_orig 	acctnsfmischdin
convertnames acchlprelhdin_orig 	acchlprelhdin
convertnames accchsupphdin_orig 	accchsupphdin
convertnames accwrkcomhdin_orig 	accwrkcomhdin
convertnames accunemphdin_orig 		accunemphdin
convertnames accotrethdin_orig 		accotrethdin
convertnames accirahdin_orig 		accirahdin
convertnames accpenshdin_orig 		accpenshdin
convertnames accvapenshdin_orig 	accvapenshdin
convertnames accsshdin_orig 		accsshdin
convertnames accothwelhdin_orig 	accothwelhdin
convertnames accssihdin_orig 		accssihdin
convertnames accearntotofumin_orig 	accearntotofumin
convertnames accadcofumin_orig 		accadcofumin
convertnames accssiofumin_orig 		accssiofumin
convertnames accofumwelfin_orig 	accofumwelfin
convertnames accofumssin_orig 		accofumssin
convertnames accofumvain_orig 		accofumvain
convertnames accofumretin_orig 		accofumretin
convertnames accofumunempin_orig 	accofumunempin
convertnames accofumwrkcmpin_orig 	accofumwrkcmpin
convertnames accofumchsuppin_orig 	accofumchsuppin
convertnames accofumhlprelin_orig 	accofumhlprelin
convertnames accofummisctrin_orig 	accofummisctrin
convertnames accofumtanfin_orig 	accofumtanfin
convertnames accfamssiin_orig 		accfamssiin
convertnames accwfothassetin_orig 	accwfothassetin
convertnames acchdhlelsein_orig 	acchdhlelsein
convertnames accwfrentin_orig 		accwfrentin
convertnames accwfotherin_orig 		accwfotherin
convertnames acchdirain_orig 		acchdirain
convertnames accwfannin_orig 		accwfannin
convertnames accwfirain_orig 		accwfirain
convertnames accwfothpenin_orig 	accwfothpenin
convertnames accofumothwelfin_orig 	accofumothwelfin
convertnames accspalimin_orig 		accspalimin
convertnames accspvain_orig 		accspvain

convertnames acchourshdin_orig 		acchourshdin
convertnames acchrsmainhdin_orig 	acchrsmainhdin
convertnames acchrsoverhdin_orig 	acchrsoverhdin
convertnames acchrsxtrahdin_orig 	acchrsxtrahdin
convertnames accweekswrkhdin_orig	accweekswrkhdin
convertnames accworkhrshdin_orig 	accworkhrshdin

convertnames acchourswfin_orig 		acchourswfin
convertnames acchrsmainwfin_orig	acchrsmainwfin
convertnames acchrsoverwfin_orig 	acchrsoverwfin
convertnames acchrsxtrawfin_orig 	acchrsxtrawfin
convertnames accweekswrkwfin_orig 	accweekswrkwfin
convertnames accworkhrswfin_orig 	accworkhrswfin


*Recodes
forv i=1/$NW {
    replace  yrsfthd`i'=yrsfthdin`i'
    replace  yrsftwf`i'=yrsftwfin`i'
    replace  employhd`i'=employhdin`i'
    replace  emplo2hd`i'=emplo2hdin`i'
    replace  emplo3hd`i'=emplo3hdin`i'
    replace  employwf`i'=employwfin`i'
    replace  emplo2wf`i'=emplo2wfin`i'
    replace  emplo3wf`i'=emplo3wfin`i'
    replace  empgovhd`i'=empgovhdin`i'
    replace  union1hd`i'=union1hdin`i'
    replace  union2hd`i'=union2hdin`i'
    replace  union3hd`i'=union3hdin`i'
    replace  empgovwf`i'=empgovwfin`i'	
    replace  union2wf`i'=union2wfin`i'
    replace  union3wf`i'=union3wfin`i'
    replace  earnwagehd`i'=earnwagehdin`i'
    replace  earnwagewf`i'=earnwagewfin`i'
    replace  earntothd`i'=earntothdin`i'
    replace  earntotwf`i'=earntotwfin`i'
    replace  wagehd`i'=wagehdin`i'
    replace  wagewf`i'=wagewfin`i'
    replace  hourshd`i'=hourshdin`i'
    replace  hourswf`i'=hourswfin`i'
  
    replace employ`i'=	employhd`i'  	if head`i'==1
    replace emplo2`i'=	emplo2hd`i'  	if head`i'==1
    replace emplo3`i'=	emplo3hd`i'  	if head`i'==1
    replace employsp`i'=employwf`i'  	if head`i'==1
    replace emplo2sp`i'=emplo2wf`i'  	if head`i'==1
    replace emplo3sp`i'=emplo3wf`i'  	if head`i'==1
    replace earnwage`i'=earnwagehd`i'  	if head`i'==1
    replace earnwagesp`i'=earnwagewf`i' if head`i'==1
    replace earntot`i'=	earntothd`i'  	if head`i'==1
    replace earntotsp`i'=earntotwf`i'   if head`i'==1
    replace wage`i'=	wagehd`i'  		if head`i'==1
    replace wagesp`i'=	wagewf`i'  		if head`i'==1
    replace hours`i'=	hourshd`i'  	if head`i'==1
    replace hourssp`i'=	hourswf`i'  	if head`i'==1
    replace empgov`i'=	empgovhd`i'  	if head`i'==1
    replace empgovsp`i'=empgovwf`i'  	if head`i'==1
    replace yrsft`i'=	yrsfthd`i'  	if head`i'==1
	replace yrsftsp`i'=	yrsftwf`i'  	if head`i'==1
    
    replace employ`i'=	employwf`i'  	if wife`i'==1
    replace emplo2`i'=	emplo2wf`i' 	if wife`i'==1
    replace emplo3`i'=	emplo3wf`i' 	if wife`i'==1
    replace employsp`i'=employhd`i' 	if wife`i'==1
    replace emplo2sp`i'=emplo2hd`i' 	if wife`i'==1
    replace emplo3sp`i'=emplo3hd`i' 	if wife`i'==1
    replace earnwage`i'=earnwagewf`i' 	if wife`i'==1
    replace earnwagesp`i'=earnwagehd`i' if wife`i'==1
    replace earntot`i'=	earntotwf`i' 	if wife`i'==1
    replace earntotsp`i'=earntothd`i' 	if wife`i'==1        
    replace wage`i'=	wagewf`i' 	if wife`i'==1
    replace wagesp`i'=	wagehd`i' 	if wife`i'==1
    replace hours`i'=	hourswf`i' 	if wife`i'==1
    replace hourssp`i'=	hourshd`i' 	if wife`i'==1
    replace empgov`i'=	empgovwf`i' if wife`i'==1
    replace empgovsp`i'=empgovhd`i' if wife`i'==1
    replace yrsft`i'=	yrsftwf`i' 	if wife`i'==1
    replace yrsftsp`i'=	yrsfthd`i' 	if wife`i'==1

	replace famearntot`i'=earntot`i'+earntotsp`i'
	
	
	
replace acctrustwf`i'=acctrustwfin`i'
replace accintwf`i'=accintwfin`i'
replace accdivwf`i'=accdivwfin`i'
replace accalimhd`i'=accalimhdin`i'
replace acctrusthd`i'=acctrusthdin`i'
replace accinthd`i'=accinthdin`i'
replace accdividhd`i'=accdividhdin`i'
replace accrenthd`i'=accrenthdin`i'
replace acctnsfmiscwf`i'=acctnsfmiscwfin`i'
replace acchlpnonrelwf`i'=acchlpnonrelwfin`i'
replace acchlprelwf`i'=acchlprelwfin`i'
replace accpenswf`i'=accpenswfin`i'
replace accsswf`i'=accsswfin`i'
replace accothwelwf`i'=accothwelwfin`i'
replace accchsuppwf`i'=accchsuppwfin`i'
replace accssiwf`i'=accssiwfin`i'
replace accwrkcomwf`i'=accwrkcomwfin`i'
replace accunempwf`i'=accunempwfin`i'
replace acctnsfmischd`i'=acctnsfmischdin`i'
replace acchlpnonrelhd`i'=acchlpnonrelhdin`i'
replace acchlprelhd`i'=acchlprelhdin`i'
replace accchsupphd`i'=accchsupphdin`i'
replace accwrkcomhd`i'=accwrkcomhdin`i'
replace accunemphd`i'=accunemphdin`i'
replace accotrethd`i'=accotrethdin`i'
replace accirahd`i'=accirahdin`i'
replace accpenshd`i'=accpenshdin`i'
replace accvapenshd`i'=accvapenshdin`i'
replace accsshd`i'=accsshdin`i'
replace accothwelhd`i'=accothwelhdin`i'
replace accssihd`i'=accssihdin`i'
replace accearntotofum`i'=accearntotofumin`i'
replace accadcofum`i'=accadcofumin`i'
replace accssiofum`i'=accssiofumin`i'
replace accofumwelf`i'=accofumwelfin`i'
replace accofumss`i'=accofumssin`i'
replace accofumva`i'=accofumvain`i'
replace accofumret`i'=accofumretin`i'
replace accofumunemp`i'=accofumunempin`i'
replace accofumwrkcmp`i'=accofumwrkcmpin`i'
replace accofumchsupp`i'=accofumchsuppin`i'
replace accofumhlprel`i'=accofumhlprelin`i'
replace accofummisctr`i'=accofummisctrin`i'
replace accofumtanf`i'=accofumtanfin`i'
replace accfamssi`i'=accfamssiin`i'
replace accwfothasset`i'=accwfothassetin`i'
replace acchdhlelse`i'=acchdhlelsein`i'
replace accwfrent`i'=accwfrentin`i'
replace accwfother`i'=accwfotherin`i'
replace acchdira`i'=acchdirain`i'
replace accwfann`i'=accwfannin`i'
replace accwfira`i'=accwfirain`i'
replace accwfothpen`i'=accwfothpenin`i'
replace accofumothwelf`i'=accofumothwelfin`i'
replace accspalim`i'=accspalimin`i'
replace accspva`i'=accspvain`i'
	
	
	
	

replace acctxinchw`i'=acctxinchwin`i'  	
replace acctransfhw`i'=acctransfhwin`i' 	
replace acctransfoth`i'=acctransfothin`i' 	
replace acctxincoth`i'=acctxincothin`i' 	
replace accassetinchw`i'=accassetinchwin`i' 	
replace inctaxtot`i'=inctaxtotin`i' 	
replace inctaxhw`i'=inctaxhwin`i' 	
replace inctaxoth`i'=inctaxothin`i' 

replace accadc`i'=accadcin`i' 	
replace accadc`i'=accadchdin`i'   if head`i'==1
replace accadcsp`i'=accadcwfin`i' if head`i'==1
replace accadc`i'=accadcwfin`i'   if wife`i'==1
replace accadcsp`i'=accadchdin`i' if wife`i'==1
	
replace accearntot`i'=accearntotin`i' 	if head`i'==1
replace accearnwage`i'=accearnwagein`i' if head`i'==1
replace accearnoth`i'=accearnothin`i' 	if head`i'==1
replace accbns`i'=accbnsin`i' 	if head`i'==1
replace accotm`i'=accotmin`i' 	if head`i'==1
replace acctip`i'=acctipin`i' 	if head`i'==1
replace acccom`i'=acccomin`i' 	if head`i'==1
replace accprf`i'=accprfin`i' 	if head`i'==1
replace accmkg`i'=accmkgin`i' 	if head`i'==1
replace accoth`i'=accothin`i' 	if head`i'==1
replace accxtr`i'=accxtrin`i' 	if head`i'==1

replace earnbus`i'=earnbusin`i' 	if head`i'==1
replace earnbussp`i'=earnbuswfin`i' if head`i'==1
replace earnbus`i'=earnbuswfin`i' 	if wife`i'==1
replace earnbussp`i'=earnbusin`i' 	if wife`i'==1

replace accbus`i'=accbusin`i' 	if head`i'==1 // Accuracy is for ALL business income (H/W, Labor/Asset)
replace accbus`i'=accbusin`i' 	if wife`i'==1 
replace accbussp`i'=accbusin`i' if head`i'==1
replace accbussp`i'=accbusin`i' if wife`i'==1

replace accfrm`i'=accfrmin`i' 	if head`i'==1
replace accfrmsp`i'=accfrmin`i' if wife`i'==1

replace frminc`i'=frmincin`i' 	if head`i'==1 // Assigned farm income to Head only (but later years also includes Wife farm inc)
replace frmincsp`i'=frmincin`i' if wife`i'==1 // Also includes only labor part early; later waves not broken down by labor/asset

replace accearntotsp`i'=accearntotwfin`i'   if head`i'==1
replace accearnwagesp`i'=accearnwagewfin`i' if head`i'==1
replace accbnssp`i'=accbnswfin`i' 	if head`i'==1
replace accotmsp`i'=accotmwfin`i' 	if head`i'==1
replace acctipsp`i'=acctipwfin`i' 	if head`i'==1
replace acccomsp`i'=acccomwfin`i' 	if head`i'==1
replace accprfsp`i'=accprfwfin`i' 	if head`i'==1
replace accothsp`i'=accothwfin`i' 	if head`i'==1
replace accxtrsp`i'=accxtrwfin`i' 	if head`i'==1

replace accearntot`i'=accearntotwfin`i'   if wife`i'==1
replace accearnwage`i'=accearnwagewfin`i' if wife`i'==1
replace accbns`i'=accbnswfin`i' 	if wife`i'==1
replace accotm`i'=accotmwfin`i' 	if wife`i'==1
replace acctip`i'=acctipwfin`i' 	if wife`i'==1
replace acccom`i'=acccomwfin`i' 	if wife`i'==1
replace accprf`i'=accprfwfin`i' 	if wife`i'==1
replace accoth`i'=accothwfin`i' 	if wife`i'==1
replace accxtr`i'=accxtrwfin`i' 	if wife`i'==1

replace accearntotsp`i'=accearntotin`i'   if wife`i'==1
replace accearnwagesp`i'=accearnwagein`i' if wife`i'==1
replace accearnothsp`i'=accearnothin`i'   if wife`i'==1
replace accbnssp`i'=accbnsin`i' if wife`i'==1
replace accotmsp`i'=accotmin`i' if wife`i'==1
replace acctipsp`i'=acctipin`i' if wife`i'==1
replace acccomsp`i'=acccomin`i' if wife`i'==1
replace accprfsp`i'=accprfin`i' if wife`i'==1
replace accmkgsp`i'=accmkgin`i' if wife`i'==1
replace accothsp`i'=accothin`i' if wife`i'==1
replace accxtrsp`i'=accxtrin`i' if wife`i'==1




} 
 
  forv i=1/8 { 
    replace lfwork`i'=  employ`i'==1	if employ`i'!=.		
    replace lfunemp`i'= employ`i'==2	if employ`i'!=.						
	replace lfretir`i'= employ`i'==3	if employ`i'!=.		
	replace lfhome`i'= 	employ`i'==4	if employ`i'!=.
	replace lfstud`i'= 	employ`i'==5	if employ`i'!=.
	replace lfother`i'= employ`i'==6	if employ`i'!=.


    replace lfworksp`i'=  employsp`i'==1	if employsp`i'!=.						
    replace lfunempsp`i'= employsp`i'==2	if employsp`i'!=.						
	replace lfretirsp`i'= employsp`i'==3	if employsp`i'!=.						
	replace lfhomesp`i'=  employsp`i'==4	if employsp`i'!=.
	replace lfstudsp`i'=  employsp`i'==5	if employsp`i'!=.
	replace lfothersp`i'= employsp`i'==6	if employsp`i'!=.
}
 forv i=9/29 {
    replace lfwork`i'=  employ`i'==1	if employ`i'!=.						
    replace lflaid`i'=	employ`i'==2	if employ`i'!=.
    replace lfunemp`i'= employ`i'==3	if employ`i'!=.	
	replace lfretir`i'= employ`i'==4	if employ`i'!=.
	replace lfdisab`i'= employ`i'==5	if employ`i'!=.						
	replace lfhome`i'= 	employ`i'==6	if employ`i'!=.
	replace lfstud`i'= 	employ`i'==7	if employ`i'!=.
	replace lfother`i'= employ`i'==8	if employ`i'!=.
    
    replace lfworksp`i'=  	employsp`i'==1	if employsp`i'!=.						
    replace lflaidsp`i'=	employsp`i'==2	if employsp`i'!=.
    replace lfunempsp`i'= 	employsp`i'==3	if employsp`i'!=.	
	replace lfretirsp`i'= 	employsp`i'==4	if employsp`i'!=.
	replace lfdisabsp`i'= 	employsp`i'==5	if employsp`i'!=.						
	replace lfhomesp`i'= 	employsp`i'==6	if employsp`i'!=.
	replace lfstudsp`i'= 	employsp`i'==7	if employsp`i'!=.
	replace lfothersp`i'= 	employsp`i'==8	if employsp`i'!=.
}

forv i=30/$NW {
    replace lfwork`i'=   	(employ`i'==1 |	emplo2`i'==1 | emplo3`i'==1) if employ`i'!=.  						
    replace lflaid`i'=		(employ`i'==2 |	emplo2`i'==2 | emplo3`i'==2) if employ`i'!=.
    replace lfunemp`i'=	 	(employ`i'==3 |	emplo2`i'==3 | emplo3`i'==3) if employ`i'!=.	
	replace lfretir`i'=		(employ`i'==4 |	emplo2`i'==4 | emplo3`i'==4) if employ`i'!=.
	replace lfdisab`i'=		(employ`i'==5 |	emplo2`i'==5 | emplo3`i'==5) if employ`i'!=.						
	replace lfhome`i'=		(employ`i'==6 |	emplo2`i'==6 | emplo3`i'==6) if employ`i'!=.
	replace lfstud`i'=		(employ`i'==7 |	emplo2`i'==7 | emplo3`i'==7) if employ`i'!=.
	replace lfother`i'=		(employ`i'==8 |	emplo2`i'==8 | emplo3`i'==8) if employ`i'!=.
	
    replace lfworksp`i'=   	(employsp`i'==1 |	emplo2sp`i'==1 | emplo3sp`i'==1) if employsp`i'!=.						
    replace lflaidsp`i'=	(employsp`i'==2 |	emplo2sp`i'==2 | emplo3sp`i'==2) if employsp`i'!=.
    replace lfunempsp`i'=	(employsp`i'==3 |	emplo2sp`i'==3 | emplo3sp`i'==3) if employsp`i'!=.	
	replace lfretirsp`i'=	(employsp`i'==4 |	emplo2sp`i'==4 | emplo3sp`i'==4) if employsp`i'!=.
	replace lfdisabsp`i'=	(employsp`i'==5 |	emplo2sp`i'==5 | emplo3sp`i'==5) if employsp`i'!=.						
	replace lfhomesp`i'=	(employsp`i'==6 |	emplo2sp`i'==6 | emplo3sp`i'==6) if employsp`i'!=.
	replace lfstudsp`i'=	(employsp`i'==7 |	emplo2sp`i'==7 | emplo3sp`i'==7) if employsp`i'!=.
	replace lfothersp`i'=	(employsp`i'==8 |	emplo2sp`i'==8 | emplo3sp`i'==8) if employsp`i'!=.
}	
forv i=1/$NW {
replace occupval`i'=occupationin`i'		// * Hold original values for occupation category (1-, 2-, or 3-digits)
}
*** OCCUPATION vARIABLES: 	(1) NEED TO DOUBLE CHECK CATEGORIES FOR ALL YEARS
***							(2) ADD OCCUPATIONS FOR WIVES
***	
*1968-1975						(3) ADD SPOUSE OCCUPATION vARIABLES FOR HEAD AND WIFE
forv i=1/8 {
	replace occupation`i'=1 	if occupationin`i'==1						 & head`i'==1	// * Professional, technical;
	replace occupation`i'=2 	if (occupationin`i'==2 | occupationin`i'==3) & head`i'==1	// * Manager/businessmen;
	replace occupation`i'=3 	if occupationin`i'==4						 & head`i'==1	// * Clerical, sales; 
	replace occupation`i'=4 	if occupationin`i'==5						 & head`i'==1	// * Craftsman, foreman;
	replace occupation`i'=5 	if occupationin`i'==6						 & head`i'==1	// * Operatives;
	replace occupation`i'=6 	if (occupationin`i'==7 | occupationin`i'==8) & head`i'==1	// * Laborers, service workers, farmers;
	replace occupation`i'=7 	if (occupationin`i'<1  | occupationin`i'>8)	 & head`i'==1	//  * NEC or missing;
	gen byte occfarm`i'= occupationin`i' if occupationin`i'==8				 & head`i'==1	// 8="Farmers & farm managers"
} 
*1976-1980                                      
forv i=9/13 {
	replace occupation`i'=1 	if (occupationin`i'>=10 & occupationin`i'<=19)  & head`i'==1	// * Professional, technical;
	replace occupation`i'=2 	if (occupationin`i'>=20 & occupationin`i'<=39)  & head`i'==1	// * Manager/businessmen;
	replace occupation`i'=3 	if (occupationin`i'>=40 & occupationin`i'<=49)  & head`i'==1	// * Clerical, sales; 
	replace occupation`i'=4 	if (occupationin`i'>=50 & occupationin`i'<=59)  & head`i'==1	// * Craftsman, foreman;
	replace occupation`i'=5 	if (occupationin`i'>=60 & occupationin`i'<=69)  & head`i'==1	// * Operatives;
	replace occupation`i'=6 	if (occupationin`i'>=70 & occupationin`i'<=89)  & head`i'==1	// * Laborers, service workers, farmers;
	replace occupation`i'=7 	if (occupationin`i'<10  | occupationin`i'>89)	& head`i'==1	//  * NEC or missing;
	gen byte occfarm`i'= occupationin`i' if inlist(occupationin`i',71,80)	    & head`i'==1	// 80="Farm (owners & tenants) & managers (except 71=laborers, foreman)"
}
*1981-2001 (uses 1970 3-digit Census codes)
forv i=14/32 {
	replace occupation`i'=1 	if (occupationin`i'>=1   & occupationin`i'<=199)	& head`i'==1	// * Professional, technical;
	replace occupation`i'=2 	if (occupationin`i'>=200 & occupationin`i'<=259)	& head`i'==1	// * Manager/businessmen;
	replace occupation`i'=3 	if (occupationin`i'>=260 & occupationin`i'<=395)	& head`i'==1	// * Clerical, sales; 
	replace occupation`i'=4 	if (occupationin`i'>=400 & occupationin`i'<=599)	& head`i'==1	// * Craftsman, foreman;
	replace occupation`i'=5 	if (occupationin`i'>=600 & occupationin`i'<=739)	& head`i'==1	// * Operatives;
	replace occupation`i'=6 	if (occupationin`i'>=740 & occupationin`i'<=989)	& head`i'==1	// * Laborers, service workers, farmers;
	replace occupation`i'=7 	if (occupationin`i'<1  | occupationin`i'>989)		& head`i'==1	//  * NEC or missing;
	replace occupation`i'=7		if occupationin`i'==810								& head`i'==1	// * Wild code ?
	gen byte occfarm`i'= occupationin`i' if inrange(occupationin`i',801,824)		& head`i'==1	// 801-802="Farmers/managers; 821-824="Farm laborers, foreman"
}
*2003-2015 (uses 2000 3-digit Census codes)
forv i=33/39 {
	replace occupation`i'=1 	if (occupationin`i'>=80 & occupationin`i'<=365)		& head`i'==1	// * Professional, technical;
	replace occupation`i'=2 	if (occupationin`i'>=1 & occupationin`i'<=73)		& head`i'==1	// * Manager/businessmen;
	replace occupation`i'=3 	if (occupationin`i'>=470 & occupationin`i'<=593)	& head`i'==1	// * Clerical, sales; 
	replace occupation`i'=4 	if (occupationin`i'>=620 & occupationin`i'<=762)	& head`i'==1	// * Craftsman, foreman;
	replace occupation`i'=5 	if (occupationin`i'>=770 & occupationin`i'<=975)	& head`i'==1	// * Operatives;
	replace occupation`i'=6 	if (occupationin`i'>=370 & occupationin`i'<=465)	& head`i'==1	// * Laborers, service workers, farmers;
	replace occupation`i'=6 	if (occupationin`i'>=600 & occupationin`i'<=613)	& head`i'==1	// * Laborers, service workers, farmers;
	replace occupation`i'=7 	if (occupationin`i'<1  | occupationin`i'>998)		& head`i'==1	//  * NEC or missing;
	gen byte occfarm`i'= .	if head`i'==1	// NEED TO LOOK AT HOW TO CODE THIS	
}
*2017-		(uses 4-digit Census codes)
forv i=40/$NW {
	replace occupation`i'=1 	if (occupationin`i'>=1000 & occupationin`i'<=3655)	& head`i'==1	// * Professional, technical;
	replace occupation`i'=2 	if (occupationin`i'>=10 & occupationin`i'<=950	)	& head`i'==1	// * Manager/businessmen;
	replace occupation`i'=3 	if (occupationin`i'>=4700 & occupationin`i'<=5940)	& head`i'==1	// * Clerical, sales; 
	replace occupation`i'=4 	if (occupationin`i'>=6200 & occupationin`i'<=6940)	& head`i'==1	// * Craftsman, foreman;
	replace occupation`i'=5 	if (occupationin`i'>=7700 & occupationin`i'<=9750)	& head`i'==1	// * Operatives;
	replace occupation`i'=6 	if (occupationin`i'>=3700 & occupationin`i'<=4650)	& head`i'==1	// * Laborers, service workers, farmers;
	replace occupation`i'=6 	if (occupationin`i'>=6005 & occupationin`i'<=6130)	& head`i'==1	// * Laborers, service workers, farmers;
	replace occupation`i'=7 	if (occupationin`i'<1  | occupationin`i'>9998)		& head`i'==1	//  * NEC or missing;
	gen byte occfarm`i'= .	if head`i'==1	// NEED TO LOOK AT HOW TO CODE THIS	
	}



forv i=1/$NW {
	replace occdum1hd`i'=  occupation`i'==1	if occupation`i'!=.						
	replace occdum2hd`i'=  occupation`i'==2	if occupation`i'!=.						
	replace occdum3hd`i'=  occupation`i'==3	if occupation`i'!=.						
	replace occdum4hd`i'=  occupation`i'==4	if occupation`i'!=.						
	replace occdum5hd`i'=  occupation`i'==5	if occupation`i'!=.						
	replace occdum6hd`i'=  occupation`i'==6	if occupation`i'!=.						
	replace occdum7hd`i'=  occupation`i'==7	if occupation`i'!=.						
}

***********************************************************************************;
*--------------------Transfers/gifts/support------------------;
			
*Create new (empty) variables
#delimit ;
newstubs employment
" 	lumppmtin			
	giftin
	giftayrin
	giftaamtin
	giftbyrin
	giftbamtin
	giftcyrin
	giftcamtin
	suppothrin
	numsuppin
	suppamtin	 	 
 lumppmt 
 inherit 
 gift 
 giftayr 
 giftaamt  
 giftbyr 
 giftbamt  
 giftcyr 
 giftcamt  
 suppothr 
 numsupp 
 suppamt 
 totgift
 " ;
 
* Globals for orig vars ;
# delimit ;
gl lumppmtin_orig
	v266 	v719
	v1385 	v2097 	v2703 	v3210 	v3629 	v4075 	v4619 	v5554 	v6096 	v6689
	v7292 	v7992 	v8611 	v9302 	v10893 	v11894 	v13405 	v14502 	v15770 	v17305
	v18709 	v20009 	v21309 	v23168 	er3703 	er6705 	er8823 	er11705 er14971 er19159
	er22532	er26513 er37531 er43522 er48847 check	check	check 	check ;  
	*1968-1983 are bracketed amounts and 1968-1969 value "9" is included with "0" 
	*("inappropriate") for all other waves and indicates "not ascertained.";
gl giftin_orig
	dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss 
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss er15115 er19311
	er22706	er26687 er37705 er43696 er49041  check	check	check 	check ;
gl giftayrin_orig
	dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss 
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss er15116 er19312
	er22707 er26688 er37706 er43697 er49042  check	check	check 	check ;
gl giftaamtin_orig
	dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss 
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss er15117 er19313
	er22708	er26689 er37707 er43698 er49043  check	check	check 	check ;
gl giftbyrin_orig
	dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss 
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss er15121 er19317
	er22712 er26693 er37711 er43702 er49047  check	check	check 	check ;
gl giftbamtin_orig
	dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss 
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss er15122 er19318
	er22713 er26694 er37712 er43703 er49048  check	check	check 	check ;
gl giftcyrin_orig
	dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss 
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss er15126 er19322
	er22717	er26698 er37716 er43707 er49052 check	check	check  	check ;
gl giftcamtin_orig
	dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss 
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss er15127 er19323
	er22718 er26699 er37717 er43708 er49053 check	check	check  	check ;
gl suppothrin_orig
	dummiss v732
	v1399 	v2111 	v2708 	v3211 	v3630 	v4076 	v4620 	v5555 	v6097 	v6690
	v7293 	v7993 	v8612 	v9303 	v10894 	v11896 	v13407 	v14504 	v15779 	v17308
	v18712 	v20012 	v21312	v23171 	er3706 	er6708 	er8826 	er11708 er14976 er19172
	er22537 er26518 er37536 er43527 er48852 check	check	check  	check ;
gl numsuppin_orig
	dummiss v733
	v1400 	v2112 	v2709 	v3212 	v3631 	v4077 	v4621 	v5556 	v6098 	v6691
	v7294 	v7994 	v8613 	v9304 	v10895 	v11897 	v13408 	v14505 	v15780 	v17309
	v18713 	v20013 	v21313 	v23172 	er3707 	er6709 	er8827 	er11709 er14977 er19173
	er22538 er26519 er37537 er43528 er48853 check	check	check  	check ;  
	*Code is truncated for 1969-1975;
gl suppamtin_orig
	v82		v530
	v1228	v1908	v2509	v3062	v3474	v3874	v4388	v5299	v5798	v6409
	v6999	v7591	v8284	v8892	v10278	v11420	v12819	v13921	v14936	v16436
	v17852	v19152	v20452	v21960	er3713 	er6715 	er8833 	er11715 er14983 er19179
	er22544	er26525 er37543 er43534 er48859 check	check	check  	check ;
#delimit cr

*Match up original vars with new vars (so col3 vars hold raw values)
convertnames lumppmtin_orig 	lumppmtin
convertnames giftin_orig 		giftin
convertnames giftayrin_orig 	giftayrin
convertnames giftaamtin_orig 	giftaamtin
convertnames giftbyrin_orig 	giftbyrin
convertnames giftbamtin_orig 	giftbamtin
convertnames giftcyrin_orig 	giftcyrin
convertnames giftcamtin_orig 	giftcamtin
convertnames suppothrin_orig 	suppothrin
convertnames numsuppin_orig 	numsuppin
convertnames suppamtin_orig 	suppamtin

*Recodes
forv i=1/15 {
	replace inherit`i'=1 if lumppmtin`i'==8
	replace inherit`i'=0 if (lumppmtin`i'>=0 & lumppmtin`i'<=7) | lumppmtin`i'==9
}
forv i=16/26 {
	replace inherit`i'=1 if lumppmtin`i'>=10000 & lumppmtin`i'<=999998 
	replace inherit`i'=0 if (lumppmtin`i'>=0 & lumppmtin`i'<10000) | lumppmtin`i'>999998 
}
forv i=27/30 {
	replace inherit`i'=1 if lumppmtin`i'>=10000 & lumppmtin`i'<=999997 
	replace inherit`i'=0 if (lumppmtin`i'>=0 & lumppmtin`i'<10000) | lumppmtin`i'>999997 
}
forv i=31/31 {
	replace totgift`i'=giftaamtin`i'							///  vERIFY THESE ARE CORRECT BEFORE USING
		if (giftayrin`i'==1997 | giftayrin`i'==1998)  
	replace totgift`i'=giftbamtin`i' 							///
		if  (giftbyrin`i'==1997 | giftbyrin`i'==1998)  
	replace totgift`i'=giftcamtin`i' 							///
		if (giftcyrin`i'==1997 | giftcyrin`i'==1998)  
	replace totgift`i'=giftaamtin`i'+giftbamtin`i' 				///
		if (giftayrin`i'==1997 | giftayrin`i'==1998)  ///
		 & (giftbyrin`i'==1997 | giftbyrin`i'==1998)  
	replace totgift`i'=giftaamtin`i'+giftcamtin`i' 				///
		if (giftayrin`i'==1997 | giftayrin`i'==1998)  ///
		 & (giftcyrin`i'==1997 | giftcyrin`i'==1998)   
	replace totgift`i'=giftbamtin`i'+giftcamtin`i' 				///
		 & (giftbyrin`i'==1997 | giftbyrin`i'==1998)  ///
		 & (giftcyrin`i'==1997 | giftcyrin`i'==1998)  		 
	replace totgift`i'=giftaamtin`i'+giftbamtin`i'+giftcamtin`i' ///
		if (giftayrin`i'==1997 | giftayrin`i'==1998)  ///
		 & (giftbyrin`i'==1997 | giftbyrin`i'==1998)  ///
		 & (giftcyrin`i'==1997 | giftcyrin`i'==1998)   		 		 

	replace inherit`i'=totgift`i'>=10000
}
forv i=32/32 {
	replace totgift`i'=giftaamtin`i'							/// 
		if (giftayrin`i'==1999 | giftayrin`i'==2000)  
	replace totgift`i'=giftbamtin`i' 							///
		if  (giftbyrin`i'==1999 | giftbyrin`i'==2000)  
	replace totgift`i'=giftcamtin`i' 							///
		if (giftcyrin`i'==1999 | giftcyrin`i'==2000)  
	replace totgift`i'=giftaamtin`i'+giftbamtin`i' 				///
		if (giftayrin`i'==1999 | giftayrin`i'==2000)  ///
		 & (giftbyrin`i'==1999 | giftbyrin`i'==2000)  
	replace totgift`i'=giftaamtin`i'+giftcamtin`i' 				///
		if (giftayrin`i'==1999 | giftayrin`i'==2000)  ///
		 & (giftcyrin`i'==1999 | giftcyrin`i'==2000)  
	replace totgift`i'=giftbamtin`i'+giftcamtin`i' 				///
		 & (giftbyrin`i'==1999 | giftbyrin`i'==2000)  ///
		 & (giftcyrin`i'==1999 | giftcyrin`i'==2000)   		 
	replace totgift`i'=giftaamtin`i'+giftbamtin`i'+giftcamtin`i' ///
		if (giftayrin`i'==1999 | giftayrin`i'==2000)  ///
		 & (giftbyrin`i'==1999 | giftbyrin`i'==2000)  ///
		 & (giftcyrin`i'==1999 | giftcyrin`i'==2000)  		 		 

	replace inherit`i'=totgift`i'>=10000
}
forv i=33/33 {
	replace inherit`i'=1 if giftin`i'==1
	replace inherit`i'=0 if giftin`i'==5 | giftin`i'==8 |giftin`i'==9
}									

*Need to add code for inherit34-36.. ;

forv i=1/36 {
	replace	lumppmt`i'=lumppmtin`i'	
	replace	suppothr`i'=suppothrin`i'
	replace numsupp`i'=numsuppin`i'
	replace suppamt`i'=suppamtin`i'
	replace giftaamt`i'=giftaamtin`i'
	replace giftayr`i'=giftayrin`i'
	replace giftbamt`i'=giftbamtin`i'
	replace giftbyr`i'=giftbyrin`i'
	replace giftcamt`i'=giftcamtin`i'
	replace giftcyr`i'=giftcyrin`i'
}

***********************************************************************************;
*----------------------------- Expenditure Information -------------------------------;
** Education expenses;
*Create new (empty) vars
#delimit ;
newstubs expenditures
  " expschanyin
	expschamtin
	expschany
	expschamt
  " ;
*Create globals for original (raw) variables
#delimit ;
gl expschanyin_orig
	dummiss dummiss
	dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss 
	dummiss	dummiss dummiss	dummiss dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss	dummiss dummiss	dummiss dummiss dummiss	dummiss dummiss	er13201 er17212
	er21848 er25804 er36822 er42813 er48135 check	check	check  	check ;
gl expschamtin_orig
	dummiss dummiss
	dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss 
	dummiss	dummiss dummiss	dummiss dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss	dummiss dummiss	dummiss dummiss dummiss	dummiss dummiss	er13202 er17213
	er21849 er25805 er36823 er42814 er48136 check	check	check  	check ;
#delimit cr

*Match up original vars with new vars (so col3 vars hold raw values)
convertnames expschanyin_orig 	expschanyin
convertnames expschamtin_orig 	expschamtin

*Recodes
forv i=31/$NW {
	replace expschany`i'=1 if expschanyin`i'==1
	replace expschany`i'=0 if expschanyin`i'==5
	replace expschamt`i'=expschamtin`i' if expschany`i'==1 & (expschamtin`i'>=0 & expschamtin`i'<=999996)
}

***********************************************************************************;
*----------------------------- Any savings -- early data  -------------------------;
*Create new (empty) vars
#delimit ;
newstubs anysavings 
  " aanysavein
  	a2xincomein
  	aanysave
  	a2xincome
  " ;
*Create globals for orig (raw) vars
#delimit ;
gl aanysavein_orig
	v159    v737 
	v1403   v2115   v2712   check   check   v4080   check   check   check   v6695 
	v7313   check   check   check   check   check   check   check   check   check
	check   check   check   check   check   check   check   check   check   check
	check	check   check   check 	check   check	check	check 	check ;
gl a2xincomein_orig
	v160    v738    
	v1404   v2116   v2713   check   check   v4081   check   check   check   v6696
	v7314   check   check   check   check   check   check   check   check   check
	check   check   check   check   check   check   check   check   check   check
	check	check   check   check	check	check	check	check 	check ;
#delimit cr

*Match up original vars with new vars (so col3 vars hold raw values)
convertnames aanysavein_orig 	aanysavein
convertnames a2xincomein_orig 	a2xincomein

set more off
*Recodes
forv i=1/13 {
	replace aanysave`i'=1 if aanysavein`i'==1 
	replace aanysave`i'=0 if aanysavein`i'==5 
	replace a2xincome`i'=1 if aanysavein`i'==1 
	replace a2xincome`i'=0 if a2xincomein`i'==5 | aanysave`i'==0
}

***********************************************************************************;
***********************************************************************************;
*--------------------------------Wealth Supplement Data------------------------;
*Create new (empty) vars
#delimit ;
newstubs wealthsupp 
 "  aanybusnin 	
 	aanycheckin 	
 	aanydebtin 	
 	aanyrealin
 	aanystockin 	
 	aanyothin 
 	aanyIRAin 	
 	avalbusnin 
 	avalcheckin 	
 	avaldebtin 
 	avalrealin 	
 	avalstockin 
 	avalcarin	
 	avalothin 
 	avalIRAin 	
 	atotnhin 
 	atotin
 
  aanybusn				           
  aanycheck		         
  aanydebt				           
  aanyreal	    	           
  aanystock		           
  aanyoth	              
  aanyIRA			           

  avalbusn			          
  avalcheck		           
  avaldebt			          
  avalreal	               
  avalstock		         
  avalcar			             
  avaloth	              
  avalIRA			            

 atot		                             
 atotnh                         
 atoth			                    
" ;

*Create globals for original (raw) variables
** For all of the any variables, 0=no and 1=yes;
** For wlth1999, varnames changed from "er" to "s" (e.g., s402, s404))
#delimit ;
gl aanybusnin_orig
	dummiss dummiss
	dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss 
	dummiss	dummiss dummiss	dummiss s102	dummiss dummiss dummiss dummiss s202
	dummiss	dummiss dummiss	dummiss s302	dummiss	dummiss dummiss	s402	s502		
	s602	s702    s802	er46936 er52344 check	check	check  	check ; 
gl aanycheckin_orig 
	dummiss dummiss
	dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss 
	dummiss	dummiss dummiss	dummiss s104	dummiss dummiss dummiss dummiss s204
	dummiss	dummiss dummiss	dummiss s304	dummiss	dummiss dummiss	s404	s504
	s604	s704    s804    er46940 er52348 check	check	check  	check ; 	
gl aanydebtin_orig 
	dummiss dummiss
	dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss 
	dummiss	dummiss dummiss	dummiss s106	dummiss dummiss dummiss dummiss s206
	dummiss	dummiss dummiss	dummiss s306	dummiss	dummiss dummiss	s406	s506
	s606	s706    s806    er46944	check 	check	check	check 	check ; 	
gl aanyrealin_orig
	dummiss dummiss
	dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss 
	dummiss	dummiss dummiss	dummiss s108	dummiss dummiss dummiss dummiss s208
	dummiss	dummiss dummiss	dummiss s308	dummiss	dummiss dummiss	s408	s508
	s608	s708    s808    er46948 er52352 check	check	check  	check ; 	  
gl aanystockin_orig
	dummiss dummiss
	dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss 
	dummiss	dummiss dummiss	dummiss s110	dummiss dummiss dummiss dummiss s210
	dummiss	dummiss dummiss	dummiss s310	dummiss	dummiss dummiss	s410	s510
	s610	s710    s810    er46952 er52356 check	check	check  	check ;	  
	* included IRA up until 1999;
gl aanyothin_orig
	dummiss dummiss
	dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss 
	dummiss	dummiss dummiss	dummiss s114	dummiss dummiss dummiss dummiss s214
	dummiss	dummiss dummiss	dummiss s314	dummiss	dummiss dummiss	s414	s514
	s614	s714    s814    er46958 er52362 check	check	check  	check ;		
gl aanyIRAin_orig
	dummiss dummiss
	dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss 
	dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss dummiss dummiss dummiss
	dummiss	dummiss dummiss	dummiss dummiss	dummiss	dummiss dummiss	s418	s518
	s618	s718    s818    er46962 er52366 check	check	check  	check ;	 	
	* For all values, Min -99,999,999, max 999,999,999, and 0 is inappropriate or breakeven;
gl avalbusnin_orig
	dummiss dummiss
	dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss 
	dummiss	dummiss dummiss	dummiss s103	dummiss dummiss dummiss dummiss s203
	dummiss	dummiss dummiss	dummiss s303	dummiss	dummiss dummiss	s403	s503
	s603	s703    s803    er46938 er52346 check	check	check  	check ;			
gl avalcheckin_orig
	dummiss dummiss
	dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss 
	dummiss	dummiss dummiss	dummiss s105	dummiss dummiss dummiss dummiss s205
	dummiss	dummiss dummiss	dummiss s305	dummiss	dummiss dummiss	s405	s505
	s605	s705    s805    er46942 er52350 check	check	check  	check ;	
gl avaldebtin_orig
	dummiss dummiss
	dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss 
	dummiss	dummiss dummiss	dummiss s107	dummiss dummiss dummiss dummiss s207
	dummiss	dummiss dummiss	dummiss s307	dummiss	dummiss dummiss	s407	s507
	s607	s707    s807    er46946 check   check	check	check 	check ;
gl avalrealin_orig
	dummiss dummiss
	dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss 
	dummiss	dummiss dummiss	dummiss s109	dummiss dummiss dummiss dummiss s209
	dummiss	dummiss dummiss	dummiss s309	dummiss	dummiss dummiss	s409	s509
	s609	s709    s809    er46950 er52354 check	check	check  	check ;
gl avalstockin_orig
	dummiss dummiss
	dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss 
	dummiss	dummiss dummiss	dummiss s111	dummiss dummiss dummiss dummiss s211
	dummiss	dummiss dummiss	dummiss s311	dummiss	dummiss dummiss	s411	s511
	s611	s711    s811    er46954 er52358 check	check	check  	check ;
gl avalcarin_orig
	dummiss dummiss
	dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss 
	dummiss	dummiss dummiss	dummiss s113	dummiss dummiss dummiss dummiss s213
	dummiss	dummiss dummiss	dummiss s313	dummiss	dummiss dummiss	s413	s513
	s613	s713    s813    er46956 er52360 check	check	check  	check;
gl avalothin_orig
	dummiss dummiss
	dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss 
	dummiss	dummiss dummiss	dummiss s115	dummiss dummiss dummiss dummiss s215
	dummiss	dummiss dummiss	dummiss s315	dummiss	dummiss dummiss	s415	s515
	s615	s715    s815    er46960 er52364 check	check	check  	check ;
gl avalIRAin_orig
	dummiss dummiss
	dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss 
	dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss dummiss dummiss dummiss
	dummiss	dummiss dummiss	dummiss dummiss	dummiss	dummiss dummiss	s419	s519
	s619	s719    s819    er46964 er52368 check	check	check  	check ;
gl atotnhin_orig
	dummiss dummiss
	dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss 
	dummiss	dummiss dummiss	dummiss s116	dummiss dummiss dummiss dummiss s216
	dummiss	dummiss dummiss	dummiss s316	dummiss	dummiss dummiss	s416	s516
	s616	s716    s816    er46968 er52392  check	check	check 	check ;		
gl atotin_orig
	dummiss dummiss
	dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss dummiss	dummiss 
	dummiss	dummiss dummiss	dummiss s117	dummiss dummiss dummiss dummiss s217
	dummiss	dummiss dummiss	dummiss s317	dummiss	dummiss dummiss	s417	s517
	s617	s717    s817    er46970 er52394  check	check	check 	check ;
#delimit cr

*Match up original vars with new vars (so col3 vars hold raw values)
convertnames aanybusnin_orig 	aanybusnin 	
convertnames aanycheckin_orig 	aanycheckin 	
convertnames aanydebtin_orig 	aanydebtin 	
convertnames aanyrealin_orig 	aanyrealin
convertnames aanystockin_orig 	aanystockin 	
convertnames aanyothin_orig 	aanyothin 
convertnames aanyIRAin_orig 	aanyIRAin 	
convertnames avalbusnin_orig 	avalbusnin 
convertnames avalcheckin_orig 	avalcheckin 	
convertnames avaldebtin_orig 	avaldebtin 
convertnames avalrealin_orig 	avalrealin 	
convertnames avalstockin_orig 	avalstockin 
convertnames avalcarin_orig 	avalcarin	
convertnames avalothin_orig 	avalothin 
convertnames avalIRAin_orig 	avalIRAin 	
convertnames atotnhin_orig 		atotnhin 
convertnames atotin_orig 		atotin 	

*Recodes	
forv i=1/$NW {
	replace	aanybusn`i' = aanybusnin`i'				
	replace aanycheck`i'= aanycheckin`i'			
	replace aanydebt`i' = aanydebtin`i'				
	replace aanyreal`i' = aanyrealin`i'	
	replace aanystock`i'= aanystockin`i'			
	replace aanyoth`i'  = aanyothin`i'	
	replace aanyIRA`i'  = aanyIRAin`i'
	replace avalbusn`i' = avalbusnin`i'  	
	replace avalcheck`i'= avalcheckin`i'
	replace avaldebt`i' = avaldebtin`i'  			
	replace avalreal`i' = avalrealin`i'	
	replace avalstock`i'= avalstockin`i'	
	replace avalcar`i'  = avalcarin`i'					
	replace avaloth`i'  = avalothin`i'	
	replace avalIRA`i'  = avalIRAin`i'							
	replace atotnh`i'   = atotnhin`i'			
	replace atot`i'     = atotin`i'								
	replace atoth`i'    = atot`i'-atotnh`i'
}	

***********************************************************************************;
*--------------------------------- Health information  ----------------------------;
*Create new (empty) vars
#delimit ;
newstubs healthinfo 
  " healthin
  	disabilin
  	health
  	disabil
  " ;
  
*Create globals for orig (raw) vars;
#delimit ;
gl healthin_orig
	dummiss dummiss
	dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss dummiss
	dummiss dummiss dummiss dummiss  v10877  v11991 v13417  v14513  v15993  v17390
	v18721  v20021  v21321  v23180  er3853  er6723  er8969  er11723  er15448 er19612
	er23009 er26990 er38202 er44175 er49494 check	check	check 	check ;
gl disabilin_orig
	v216	v743	
	v1409	v2121	v2718	v3244	v3666	v4145	v4625	v5560	v6102	v6710
	v7343   v7974   v8616   v9290   v10879   v11993  v13427 v14515  v15994  v17391
	v18722  v20022  v21322  v23181  er3854  er6724  er8970  er11724 er15449 er19613
	er23014 er26995 er38206 er44179 er49498 check	check	check  	check ;	

#delimit cr

*Match up original vars with new vars (so col3 vars hold raw values)
convertnames  healthin_orig 	healthin
convertnames  disabilin_orig    disabilin

*Recodes
forv i=1/$NW {
	replace health`i'=healthin`i' 
	replace disabil`i'=disabilin`i' 
}


***************
* SAVE DATA *

cd $rawdata
qui compress
save psidmain_clean, replace


log close
clear

   
